public static function bytesToString($bytes) {
    $units = array_map('t', ['bytes', 'KB', 'MB', 'GB', 'TB']);

    while ($bytes > 1024) {
      $bytes /= 1024;
      array_shift($units);
    }
    return $bytes . ' ' . reset($units);
  }
public static function bytesToString($bytes) {
    $units = array_map('t', ['bytes', 'KB', 'MB', 'GB', 'TB']);

    while ($bytes > 1024) {
      $bytes /= 1024;
      array_shift($units);
    }
    return $bytes . ' ' . reset($units);
  }
public static function bytesToString ( $ bytes ) { $ units = array_map ( 't' , [ 'bytes' , 'KB' , 'MB' , 'GB' , 'TB' ] ) ; while ( $ bytes > 1024 ) { $ bytes /= 1024 ; array_shift ( $ units ) ; } return $ bytes . ' ' . reset ( $ units ) ; }
Converts a number of bytes into a human-readable string.

@param int $bytes
A number of bytes.

@return string
The human-readable measurement, like '2 MB' or '10 GB'.
Converts a number of bytes into a human - readable string .