Documentation

Num
in package

Pop utils number helper class

Tags
category

Pop

author

Nick Sagona, III dev@noladev.com

copyright

Copyright (c) 2009-2026 NOLA Interactive, LLC.

license

https://www.popphp.org/license New BSD License

version
2.3.0

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
string

convertPercentage()

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
string

currency()

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
string

float()

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
string

percentage()

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
string

readable()

Format number to human-readable value

public static readable(mixed $number[, bool $case = true ]) : string
Parameters
$number : mixed
$case : bool = true
Return values
string

        
On this page

Search results