1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

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