filesizes K -> KB, M -> MB, etc.

This commit is contained in:
Starbeamrainbowlabs 2015-04-09 15:29:29 +01:00
parent cad26c8221
commit 69515ece3e
2 changed files with 2 additions and 2 deletions

View File

@ -353,7 +353,7 @@ class Slimdown {
//from http://php.net/manual/en/function.filesize.php#106569
function human_filesize($bytes, $decimals = 2)
{
$sz = 'BKMGTPEYZ';
$sz = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "YB", "ZB"];
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}

View File

@ -477,7 +477,7 @@ class Slimdown {
//from http://php.net/manual/en/function.filesize.php#106569
function human_filesize($bytes, $decimals = 2)
{
$sz = 'BKMGTPEYZ';
$sz = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "YB", "ZB"];
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
}