src/Util.php
public static function formatByteSize( $size, $precision = 1, $symbols = NULL )
    {
        if ( $symbols === NULL ){
            $symbols = array('B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
        }
        $i=0;
        while (($size/1024)>1) {
            $size=$size/1024;
            $i++;
        }
        return (round($size,$precision)." ".$symbols[$i]);
    }
public static function formatByteSize( $size, $precision = 1, $symbols = NULL )
    {
        if ( $symbols === NULL ){
            $symbols = array('B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb');
        }
        $i=0;
        while (($size/1024)>1) {
            $size=$size/1024;
            $i++;
        }
        return (round($size,$precision)." ".$symbols[$i]);
    }
public static function formatByteSize ( $ size , $ precision = 1 , $ symbols = NULL ) { if ( $ symbols === NULL ) { $ symbols = array ( 'B' , 'Kb' , 'Mb' , 'Gb' , 'Tb' , 'Pb' ) ; } $ i = 0 ; while ( ( $ size / 1024 ) > 1 ) { $ size = $ size / 1024 ; $ i ++ ; } return ( round ( $ size , $ precision ) . " " . $ symbols [ $ i ] ) ; }
format byte size

@param int $size
@param int $precision
@param array $symbols

@return string
format byte size