JHtmlNumber

HTML helper class for rendering numbers.

abstract
since

1.6

package

Joomla.Libraries

Methods

bytes

Converts bytes to more distinguishable formats such as: kilobytes, megabytes, etc.

bytes(string $bytes, string $unit = 'auto', integer $precision = 2, boolean $iec = false) : string
static

By default, the proper format will automatically be chosen. However, one of the allowed unit types (viz. 'b', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB') may also be used instead. IEC standard unit types ('KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB') can be used as well.

since

1.6

link

https://en.wikipedia.org/wiki/Binary_prefix

Arguments

$bytes

stringThe number of bytes. Can be either numeric or suffixed format: 32M, 60K, 12G or 812b

$unit

stringThe 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

$precision

integerThe number of digits to be used after the decimal place.

$iec

booleanWhether 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

Response

stringThe number of bytes in the proper units.