note 60141 deleted from function.filesize by derick
| From: | derick@php.net | Date: | Thu, 23 Feb 2006 14:22:44 +0000 |
| Subject: | note 60141 deleted from function.filesize by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104300@lists.php.net to get a copy of this message | ||
Note Submitter: php at arcannon dot com
----
itsacon version is great, except when the file size is zero. I added a short condition to check for
it.
function human_file_size($size) {
if($size == 0) {
return("0 Bytes");
}
$filesizename = array(" Bytes", " KB", " MB", " GB", "
TB", " PB", " EB", " ZB", " YB");
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
}