public function formatMemorySize($size, $precision = 2)
    {
        $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
        if ($size == 0) {
            return $this->__('n/a');
        } else {
            $value = round($size / pow(1000, ($i = floor(log($size, 1000)))), $precision);
            $unitIndex = (int)$i;
            return $this->__('%s%s', $this->formatNumber($value, $precision), $sizes[$unitIndex]);
        }
    }
public function formatMemorySize($size, $precision = 2)
    {
        $sizes = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB");
        if ($size == 0) {
            return $this->__('n/a');
        } else {
            $value = round($size / pow(1000, ($i = floor(log($size, 1000)))), $precision);
            $unitIndex = (int)$i;
            return $this->__('%s%s', $this->formatNumber($value, $precision), $sizes[$unitIndex]);
        }
    }
public function formatMemorySize ( $ size , $ precision = 2 ) { $ sizes = array ( " Bytes" , " KB" , " MB" , " GB" , " TB" , " PB" , " EB" , " ZB" , " YB" ) ; if ( $ size == 0 ) { return $ this -> __ ( 'n/a' ) ; } else { $ value = round ( $ size / pow ( 1000 , ( $ i = floor ( log ( $ size , 1000 ) ) ) ) , $ precision ) ; $ unitIndex = ( int ) $ i ; return $ this -> __ ( '%s%s' , $ this -> formatNumber ( $ value , $ precision ) , $ sizes [ $ unitIndex ] ) ; } }
Returns readable file size

@param int $size size in bytes
@param int $precision
@return string
Returns readable file size