public function format($bytes, $precision = null)
    {
        $bytes = $this->normalizeBytes($bytes);
        $out = $bytes . 'B';

        foreach ($this->suffixes as $power => $suffix) {
            if (bccomp($calc = $this->divPow($bytes, $this->base, $power), 1) >= 0) {
                $out = $this->formatNumber($calc, $suffix, $precision);
                break;
            }
        }

        return $out;
    }
public function format($bytes, $precision = null)
    {
        $bytes = $this->normalizeBytes($bytes);
        $out = $bytes . 'B';

        foreach ($this->suffixes as $power => $suffix) {
            if (bccomp($calc = $this->divPow($bytes, $this->base, $power), 1) >= 0) {
                $out = $this->formatNumber($calc, $suffix, $precision);
                break;
            }
        }

        return $out;
    }
public function format ( $ bytes , $ precision = null ) { $ bytes = $ this -> normalizeBytes ( $ bytes ) ; $ out = $ bytes . 'B' ; foreach ( $ this -> suffixes as $ power => $ suffix ) { if ( bccomp ( $ calc = $ this -> divPow ( $ bytes , $ this -> base , $ power ) , 1 ) >= 0 ) { $ out = $ this -> formatNumber ( $ calc , $ suffix , $ precision ) ; break ; } } return $ out ; }
Format input into a human-friendly string for display

@uses \bccomp()
@uses AbstractFormatter::divPow()
@uses AbstractFormatter::formatNumber()
@uses AbstractFormatter::normalizeBytes()

@param  integer|string $bytes Integer or string representing the number
of bytes.
@param  integer $precision Number of significant digits to include in the
formatted output. Defaults to 2.
@return string Returns a human-friendly formatted string.
Format input into a human - friendly string for display