Back to Joomla project (class list)

Class Number - list of methods

HTML helper class for rendering numbers.
Package: Joomla\CMS\HTML\Helpers
Copyright: (C) 2010 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
Located at: Joomla/HTML/Helpers/Number.php
Project: Joomla

Method Summary

public static string
(mixed $bytes, mixed $unit = 'auto', mixed $precision = 2, mixed $iec = false)

Converts bytes to more distinguishable formats such as: kilobytes, megabytes, etc.
Parameters
  • string $bytes The number of bytes. Can be either numeric or suffixed format: 32M, 60K, 12G or 812b
  • string $unit The type of unit to return, few special values are: Blank string '' for no unit, 'auto' to choose automatically (default) 'binary' to choose automatically but use binary unit prefix
  • int $precision The number of digits to be used after the decimal place.
  • bool $iec Whether to be aware of IEC standards. IEC prefixes are always acceptable in input. When IEC is ON: KiB = 1024 B, KB = 1000 B When IEC is OFF: KiB = 1024 B, KB = 1024 B
Returns
  • string The number of bytes in the proper units.
Since
  • 1.6
-
  • https://en.wikipedia.org/wiki/Binary_prefix
Show source code of this method: bytes Source Code

Tags Summary

Since
1.6