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:
parent
cad26c8221
commit
69515ece3e
2 changed files with 2 additions and 2 deletions
2
core.php
2
core.php
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue