1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-07-31 18:30:20 +02:00

Gelato: Number Class - updated bytes format (JEDEC & IEC 60027) by mbarzda

This commit is contained in:
Awilum
2013-12-25 00:08:56 +02:00
parent 6f55f9238b
commit b29abf8da1

View File

@@ -28,7 +28,7 @@ class Number
}
/**
* Convert bytes in 'kb','mb','gb','tb','pb'
* Convert bytes in 'KB','MB','GB','TiB','PiB'
*
* <code>
* echo Number::byteFormat(10000);
@@ -42,7 +42,7 @@ class Number
// Redefine vars
$size = (int) $size;
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
$unit = array('B', 'KB', 'MB', 'GB', 'TiB', 'PiB');
return @round($size/pow(1024, ($i=floor(log($size, 1024)))), 2).' '.$unit[($i < 0 ? 0 : $i)];
}