SizeUnits
FinalYes
Constants
Methods
- gbToBytes() : int
- humanReadable() : string
- Format a byte count as a human-readable string (binary units: B, KiB, MiB, GiB, TiB, PiB).
- kbToBytes() : int
- mbToBytes() : int
Constants
GiB_SIZE
public
mixed
GiB_SIZE
= 1073741824
KiB_SIZE
public
mixed
KiB_SIZE
= 1024
MiB_SIZE
public
mixed
MiB_SIZE
= 1048576
Methods
gbToBytes()
public
static gbToBytes(int $gb) : int
Parameters
- $gb : int
Return values
inthumanReadable()
Format a byte count as a human-readable string (binary units: B, KiB, MiB, GiB, TiB, PiB).
public
static humanReadable(null|int $bytes[, int $decimals = 2 ][, string $decimalSeparator = '.' ][, string $thousandsSeparator = ',' ][, string $null = '-' ]) : string
The tail arguments mirror PHP's number_format signature for the fractional part.
Parameters
- $bytes : null|int
-
size in bytes, or null for "unknown" (returns $null)
- $decimals : int = 2
-
Number of fractional digits for non-byte units. Ignored for raw bytes.
- $decimalSeparator : string = '.'
-
decimal separator (passed to number_format)
- $thousandsSeparator : string = ','
-
thousands separator for the integer part (passed to number_format)
- $null : string = '-'
-
placeholder returned when $bytes is null
Return values
stringkbToBytes()
public
static kbToBytes(int $kb) : int
Parameters
- $kb : int
Return values
intmbToBytes()
public
static mbToBytes(int $mb) : int
Parameters
- $mb : int