Num
in package
Pop utils number helper class
Tags
Table of Contents
Methods
- abbreviate() : string
- Abbreviate number
- convertPercentage() : string
- Convert a numeric float to a percentage-formatted string
- currency() : string
- Return a currency-formatted string
- float() : string
- Return a formatted float
- percentage() : string
- Return a percentage-formatted string
- readable() : string
- Format number to human-readable value
Methods
abbreviate()
Abbreviate number
public
static abbreviate(mixed $number[, int $precision = 2 ][, bool $uppercase = true ][, string $space = '' ]) : string
Parameters
- $number : mixed
- $precision : int = 2
- $uppercase : bool = true
- $space : string = ''
Return values
stringconvertPercentage()
Convert a numeric float to a percentage-formatted string
public
static convertPercentage(mixed $number[, int $precision = 2 ][, string $decimal = '.' ]) : string
Parameters
- $number : mixed
- $precision : int = 2
- $decimal : string = '.'
Return values
stringcurrency()
Return a currency-formatted string
public
static currency(mixed $number[, string $currency = '$' ][, string $separator = ',' ][, string $decimal = '.' ][, int $precision = 2 ]) : string
Parameters
- $number : mixed
- $currency : string = '$'
- $separator : string = ','
- $decimal : string = '.'
- $precision : int = 2
Return values
stringfloat()
Return a formatted float
public
static float(mixed $number[, string $separator = '' ][, string $decimal = '.' ][, int $precision = 2 ]) : string
Parameters
- $number : mixed
- $separator : string = ''
- $decimal : string = '.'
- $precision : int = 2
Return values
stringpercentage()
Return a percentage-formatted string
public
static percentage(mixed $number[, int $precision = 2 ][, string $decimal = '.' ]) : string
Parameters
- $number : mixed
- $precision : int = 2
- $decimal : string = '.'
Return values
stringreadable()
Format number to human-readable value
public
static readable(mixed $number[, bool $case = true ]) : string
Parameters
- $number : mixed
- $case : bool = true