src/bbn/str.php
public static function say_size($bytes, $unit = 'B', $stop = false): string
  {
// pretty printer for byte values
//
    $i = 0;
    $units = ['', 'K', 'M', 'G', 'T'];
    while ( $stop || ($bytes > 2000) ){
      $i++;
      $bytes /= 1024;
      if ( $stop === $units[$i] ){
        break;
      }
    }
    return sprintf("%5.2f %s".$unit, $bytes, $units[$i]);
  }
public static function say_size($bytes, $unit = 'B', $stop = false): string
  {
// pretty printer for byte values
//
    $i = 0;
    $units = ['', 'K', 'M', 'G', 'T'];
    while ( $stop || ($bytes > 2000) ){
      $i++;
      $bytes /= 1024;
      if ( $stop === $units[$i] ){
        break;
      }
    }
    return sprintf("%5.2f %s".$unit, $bytes, $units[$i]);
  }
public static function say_size ( $ bytes , $ unit = 'B' , $ stop = false ) : string { // pretty printer for byte values // $ i = 0 ; $ units = [ '' , 'K' , 'M' , 'G' , 'T' ] ; while ( $ stop || ( $ bytes > 2000 ) ) { $ i ++ ; $ bytes /= 1024 ; if ( $ stop === $ units [ $ i ] ) { break ; } } return sprintf ( "%5.2f %s" . $ unit , $ bytes , $ units [ $ i ] ) ; }
Converts the bytes to another unit form.

@param int $bytes The bytes
@param string The unit you want to convert ('B', 'K', 'M', 'G', 'T')
@parma boolean $stop
@return string
Converts the bytes to another unit form .