Conditions | 1 |
Paths | 1 |
Total Lines | 12 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public static function getHumanReadableBytes($value) |
||
18 | { |
||
19 | static $unit = array('B', 'KB', 'MB', 'GB', 'TB'); |
||
20 | |||
21 | $i = floor(log($value, 1024)); |
||
22 | $i = min($i, 4); // Only go up to TB |
||
23 | |||
24 | return array( |
||
25 | 'value' => (float) ($value / pow(1024, $i)), |
||
26 | 'unit' => $unit[$i], |
||
27 | ); |
||
28 | } |
||
29 | } |
||
30 |