Common operations and tools related with numbers
package | Default |
---|
forceNumeric(mixed $value,string $valueName = '',string $errorMessage = 'must be numeric'): void
Throws |
|
---|
mixed
A value to check
string
The name of the value to be shown at the beginning of the exception message
string
The rest of the exception message
forcePositiveInteger(mixed $value,string $valueName = '',string $errorMessage = 'must be a positive integer'): void
Throws |
|
---|
mixed
A value to check
string
The name of the value to be shown at the beginning of the exception message
string
The rest of the exception message
generateRandomInteger(integer $min,integer $max): integer
Throws |
|
---|
integer
lowest possible value (negative values are allowed)
integer
highest possible value (negative values are allowed)
integer
A random integer value between min and max
getNumeric(mixed $value): \org\turbocommons\src\main\php\utils\number
mixed
A value to convert to a number
\org\turbocommons\src\main\php\utils\number
The numeric type representation from the given value. For example, a string '0001' will return 1
isInteger(mixed $value): boolean
mixed
A value to check
boolean
true if the given value is a numeric integer or represents a numeric integer value, false otherwise
isNumeric(mixed $value): boolean
mixed
A value to check
boolean
true if the given value is numeric or represents a numeric value, false otherwise