src/Headzoo/Core/Conversions.php
public static function bytesToHuman($bytes, $decimals = 2)
    {
        $bytes = max($bytes, 0);
        $pow = floor(($bytes ? log($bytes) : 0) / log(self::KILOBYTE));
        $pow = min($pow, count(self::$byte_units) - 1);
        $bytes /= pow(self::KILOBYTE, $pow);
        
        return self::numberFormat($bytes, $decimals) . self::$byte_units[$pow];
    }
public static function bytesToHuman($bytes, $decimals = 2)
    {
        $bytes = max($bytes, 0);
        $pow = floor(($bytes ? log($bytes) : 0) / log(self::KILOBYTE));
        $pow = min($pow, count(self::$byte_units) - 1);
        $bytes /= pow(self::KILOBYTE, $pow);
        
        return self::numberFormat($bytes, $decimals) . self::$byte_units[$pow];
    }
public static function bytesToHuman ( $ bytes , $ decimals = 2 ) { $ bytes = max ( $ bytes , 0 ) ; $ pow = floor ( ( $ bytes ? log ( $ bytes ) : 0 ) / log ( self :: KILOBYTE ) ) ; $ pow = min ( $ pow , count ( self :: $ byte_units ) - 1 ) ; $ bytes /= pow ( self :: KILOBYTE , $ pow ) ; return self :: numberFormat ( $ bytes , $ decimals ) . self :: $ byte_units [ $ pow ] ; }
Converts a byte number into a human readable format

Examples:
```php
echo Conversions::bytesToHuman(100);
// Outputs: "100B"

echo Conversions::bytesToHuman(1024);
// Outputs: "1KB"

echo Conversions::bytesToHuman(1050);
// Outputs: "1.02KB"
```

@param  int $bytes The number of bytes
@param  int $decimals Number of decimal places to round to

@return string
Converts a byte number into a human readable format