note 44587 added to function.log
| From: | Ren at osu1 dot php dot net | Date: | Tue, 10 Aug 2004 09:02:09 +0000 |
| Subject: | note 44587 added to function.log | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-74396@lists.php.net to get a copy of this message | ||
/**
* The number of bytes in a kilobyte.
*/
define('BYTES_PER_K', 1024);
/**
* @param int $numOfBytes the number of bytes to format
* @param int $decimals the maximum number of decimal points to display
* @param string $decimalPoint decimal point
* @return string
*/
function filesize_format($numOfBytes, $decimals = 1, $decimalPoint = '.')
{
$u = array('B ', 'KB', 'MB', 'GB', 'TB',
'PB', 'EB', 'ZB', 'YB');
$i = abs($numOfBytes);
$i = $i < BYTES_PER_K ? 0 : min(floor(log($i, BYTES_PER_K)), count($u) - 1);
return ($i == 0 ? (string)$numOfBytes : number_format($numOfBytes / pow(BYTES_PER_K, $i),
$decimals, $decimalPoint, '')).' '.$u[$i];
}
----
Manual Page -- http://www.php.net/manual/en/function.log.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44587
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44587&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44587&report=yes
Search -- http://master.php.net/manage/user-notes.php