Php > Code Snippets
File size function
File size function = 1073741824) { $size = round($size / 1073741824) . " gigabytes "; } elseif($size >= 1048756) { $size = round($size / 1048576) . " megabytes "; } elseif($size >= 1024) { $size = round($size / 1024) . " kilobytes "; } else { $size = $size . " bytes "; } return $size; } ?> Now lets test this function out with the following . "; echo "this page is " . file_size("filesize.php"); ?>
Php Codes
Algorithms
Arrays
Authentication
Calendar
Code Snippets
Programs
Content Manage
Contest Related
Cookies
Credit Cards
DBase Related
Databases
Date Time
Directories
E-Mail
Errors
File
File System
Forms
Handling
Graphics
HTML and PHP
Informix
Ingres
InterBase
LDAP
Look and Feel
Miscellaneous
MySQL
Other
PHP Classes
Searching
Navigation
Statistics
Strings
User Manage