Oihana PHP

FileSizeUnit uses ConstantsTrait

FileSizeUnit

Enumeration of the binary (base-1024) file-size unit symbols used to render human-readable sizes, from bytes up to petabytes.

Tags
author

Marc Alcaraz (ekameleon)

since
1.2.0
see
formatFileSize()

Table of Contents

Constants

B  : string = 'B'
Bytes.
GB  : string = 'GB'
Gigabytes (1024 MB).
KB  : string = 'KB'
Kilobytes (1024 bytes).
MB  : string = 'MB'
Megabytes (1024 KB).
PB  : string = 'PB'
Petabytes (1024 TB).
TB  : string = 'TB'
Terabytes (1024 GB).

Methods

ordered()  : array<int, string>
Returns the unit symbols ordered by ascending magnitude (base 1024).

Constants

Methods

ordered()

Returns the unit symbols ordered by ascending magnitude (base 1024).

public static ordered() : array<int, string>

The index of each symbol is the power of 1024 it represents (0 => B, 1 => KB, … 5 => PB).

Return values
array<int, string>

The ordered list of unit symbols.

On this page

Search results