note 55754 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Wed, 09 Nov 2005 06:14:47 +0000 |
| Subject: | note 55754 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98298@lists.php.net to get a copy of this message | ||
Note Submitter: anommander dot rake at gmail dot com
----
The second function was naturally supposed to look like this:
<?
function filesize_format_alt2 ($bytes)
{
if ( 0 > $bytes)
{
return $bytes;
}
$names = array( 'B', 'KB', 'MB', 'GB', 'TB');
$values = array( 1, 1024, 1048576, 1073741824, 1099511627776);
$i = floor(log($bytes)/6.9314718055994530941723212145818); //log(1024) =
6.9314718055994530941723212145818
return number_format($bytes/$values[$i]).' '.$names[$i];
}
?>
sorry