public static function formatDataSizeFromBytes(int $b): string
    {
        $unit = '';
        foreach (['B', 'KB', 'MB', 'GB', 'TB'] as $unit) {
            if ($b < 1024) break;
            $b = round($b / 1024, 1);
        }

        return $b . ' ' . $unit;
    }
public static function formatDataSizeFromBytes(int $b): string
    {
        $unit = '';
        foreach (['B', 'KB', 'MB', 'GB', 'TB'] as $unit) {
            if ($b < 1024) break;
            $b = round($b / 1024, 1);
        }

        return $b . ' ' . $unit;
    }
public static function formatDataSizeFromBytes ( int $ b ) : string { $ unit = '' ; foreach ( [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' ] as $ unit ) { if ( $ b < 1024 ) break ; $ b = round ( $ b / 1024 , 1 ) ; } return $ b . ' ' . $ unit ; }
Converts file size from bytes to readable format

@param int $b - File size

@return string $res - Size in readable format
Converts file size from bytes to readable format