NumericUtils

Common operations and tools related with numbers

package

Default

Methods

Generate a random integer between the specified range (both extremes are included).

generateRandomInteger(integer $min, integer $max) : integer
static
Throws
\UnexpectedValueException

if max is equal or less than min.

Arguments

$min

integer

lowest possible value (negative values are allowed)

$max

integer

highest possible value (negative values are allowed)

Response

integer

A random integer value between min and max

Get the number represented by the given value

getNumeric(mixed $value) : \org\turbocommons\src\main\php\utils\number
static

Arguments

$value

mixed

A value to convert to a number

Response

\org\turbocommons\src\main\php\utils\number

The numeric type representation from the given value. For example, a string '0001' will return 1

Tells if the given value is a numeric integer or not

isInteger(mixed $value) : boolean
static

Arguments

$value

mixed

A value to check

Response

boolean

true if the given value is a numeric integer or represents a numeric integer value, false otherwise

Tells if the given value is numeric or not

isNumeric(mixed $value) : boolean
static

Arguments

$value

mixed

A value to check

Response

boolean

true if the given value is numeric or represents a numeric value, false otherwise