1) $string .= 's'; } else { if(!$decimal) $string .= 'i'; $string .= 'B'; } return $string; } /** * Formats a raw amount of bytes as a human readable string in the power of 10 (e.g. MB). * * @param int $bytes Number of bytes. * @return string Formatted byte string. */ public static function formatDecimal(int $bytes): string { return self::format($bytes, true); } /** * Formats a raw amount of bytes as a human readable string in the power of 2 (e.g. MiB). * * @param int $bytes Number of bytes. * @return string Formatted byte string. */ public static function formatBinary(int $bytes): string { return self::format($bytes, false); } }