i made this function and want to know if i am doing the math correctly..
seems to be caculating ok.. $filesize is in bytes.. if the filesize is under
1MB i want to show KBs, if its under 1GB i want to show MB, if its over
1000MB i want to show GB, makes sense? ;)
function byte_format($filesize)
{
if ($filesize < 1000000)
{
return number_format($filesize / 1024, 2, '.', '') . ' KB';
}
else if($filesize > 1000000000)
{
return number_format($filesize / 1024 / 1024 / 1024, 2, '.', '') .
' GB';
}
else
{
return number_format($filesize / 1024 / 1024, 2, '.', '') . ' MB';
}
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php