src/sys/file/SysFile.php
public static function getHumanSize($size, $precision = 1)
    {
        $units = array(" bytes", "K", "M", "G", "T", "P", "E", "Z", "Y");
        $pow = 1024;
        $factor = 0;

        while ($size + 1 > $pow) {
            $size /= $pow;
            $factor++;
        }

        return round($size, $precision) . $units[$factor];
    }
public static function getHumanSize($size, $precision = 1)
    {
        $units = array(" bytes", "K", "M", "G", "T", "P", "E", "Z", "Y");
        $pow = 1024;
        $factor = 0;

        while ($size + 1 > $pow) {
            $size /= $pow;
            $factor++;
        }

        return round($size, $precision) . $units[$factor];
    }
public static function getHumanSize ( $ size , $ precision = 1 ) { $ units = array ( " bytes" , "K" , "M" , "G" , "T" , "P" , "E" , "Z" , "Y" ) ; $ pow = 1024 ; $ factor = 0 ; while ( $ size + 1 > $ pow ) { $ size /= $ pow ; $ factor ++ ; } return round ( $ size , $ precision ) . $ units [ $ factor ] ; }
Gets a human readable size.

This function gets an human readable size.

For example:
```php
// human readable sizes:
echo SysFile::getHumanSize(13);           // prints 13 bytes
echo SysFile::getHumanSize(1024);         // prints 1K
echo SysFile::getHumanSize(4562154, 2);   // prints 4.35M (2 digits)
echo SysFile::getHumanSize(98543246875);  // prints 91.8G
```

@param integer $size      Size in bytes
@param integer $precision Digit precision (default is 1)

@return string
Gets a human readable size .