|
@@ 357-363 (lines=7) @@
|
| 354 |
|
* |
| 355 |
|
* @return string letteral size |
| 356 |
|
**/ |
| 357 |
|
public static function bytesToSize1000($bytes, $precision = 2) |
| 358 |
|
{ |
| 359 |
|
// human readable format -- powers of 1000 |
| 360 |
|
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb'); |
| 361 |
|
|
| 362 |
|
return @round($bytes / pow(1000, $i = floor(log($bytes, 1000))), $precision) . ' ' . $unit[(int)$i]; |
| 363 |
|
} |
| 364 |
|
|
| 365 |
|
/** |
| 366 |
|
* @param $bytes |
|
@@ 371-377 (lines=7) @@
|
| 368 |
|
* |
| 369 |
|
* @return string |
| 370 |
|
*/ |
| 371 |
|
public static function bytesToSize1024($bytes, $precision = 2) |
| 372 |
|
{ |
| 373 |
|
// human readable format -- powers of 1024 |
| 374 |
|
$unit = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'); |
| 375 |
|
|
| 376 |
|
return @round($bytes / pow(1024, $i = floor(log($bytes, 1024))), $precision) . ' ' . $unit[(int)$i]; |
| 377 |
|
} |
| 378 |
|
|
| 379 |
|
/** |
| 380 |
|
* This function transforms the php.ini notation for numbers (like '2M') to an integer (2*1024*1024 in this case) |