note 56999 deleted from function.filesize by derick
| From: | derick@php.net | Date: | Thu, 23 Feb 2006 14:22:30 +0000 |
| Subject: | note 56999 deleted from function.filesize by derick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104299@lists.php.net to get a copy of this message | ||
Note Submitter: itsacon at itsacon dot net
----
As of PHP 4.3.0, the 'human readable' file size function with the log() function can be
made much easier
This is my version:
<?php
function human_file_size($size)
{
$filesizename = array(" Bytes", " KB", " MB", " GB", "
TB", " PB", " EB", " ZB", " YB");
return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i];
}
?>