Command/ReindexCommand.php
protected function humanBytes($bytes, $dec = 2)
    {
        $size = ['b', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
        $factor = (int) floor((strlen($bytes) - 1) / 3);

        return sprintf("%.{$dec}f", $bytes / pow(1024, $factor)) . $size[$factor];
    }
protected function humanBytes($bytes, $dec = 2)
    {
        $size = ['b', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
        $factor = (int) floor((strlen($bytes) - 1) / 3);

        return sprintf("%.{$dec}f", $bytes / pow(1024, $factor)) . $size[$factor];
    }
protected function humanBytes ( $ bytes , $ dec = 2 ) { $ size = [ 'b' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] ; $ factor = ( int ) floor ( ( strlen ( $ bytes ) - 1 ) / 3 ) ; return sprintf ( "%.{$dec}f" , $ bytes / pow ( 1024 , $ factor ) ) . $ size [ $ factor ] ; }
Converts bytes into human readable.

Inspired by http://jeffreysambells.com/2012/10/25/human-readable-filesize-php

@param int $bytes
@param int $dec

@return string
Converts bytes into human readable .