compat size() func
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@144 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
9c3e3d9e8b
commit
ab1bf16c23
|
@ -40,16 +40,16 @@ function number_formats($a, $keys)
|
|||
return $a;
|
||||
}
|
||||
|
||||
function size($size, $suffix = '', $precision = 2)
|
||||
function size($size)
|
||||
{
|
||||
$size = (int) $size;
|
||||
if ($size < 1024)
|
||||
return number_format($size, $precision) . ' ' . $suffix;
|
||||
return number_format($size, 2) . ' b';
|
||||
|
||||
if ($size < 1048576)
|
||||
return number_format($size / 1024, $precision) . ' K' . $suffix;
|
||||
return number_format($size / 1024, 2) . ' K';
|
||||
|
||||
return number_format($size / 1048576, $precision) . ' M' . $suffix;
|
||||
return number_format($size / 1048576, 2) . ' M';
|
||||
}
|
||||
|
||||
function age($time)
|
||||
|
|
Loading…
Reference in New Issue