- class
num
(php\lib\num
) - package
std
- source
php/lib/num.php
Child Classes
Description
Utils for numbers
Class num
num ::
compare()
- Compare two numbersnum ::
toBin()
- Returns a string representation of the $numbernum ::
toOctal()
- Returns a string representation of the $numbernum ::
toHex()
- Returns a string representation of the $numbernum ::
toString()
- Returns a string representation of the first argument in thenum ::
reverse()
- Returns the value obtained by reversing the order of the bits in thenum ::
decode()
- Decodes a string into a integer.num ::
format()
num::compare(int|double $num1, int|double $num2): int
Compare two numbers
.. note:: it can be used as comparator for number sorting
num::toBin(int $number): string
Returns a string representation of the $number argument as an unsigned integer in base 2.
num::toOctal(int $number): string
Returns a string representation of the $number argument as an unsigned integer in base 8.
num::toHex(int $number): string
Returns a string representation of the $number argument as an unsigned integer in base 16.
num::toString(int $number, int $radix): string
Returns a string representation of the first argument in the radix specified by the second argument.
num::reverse(int $number): int
Returns the value obtained by reversing the order of the bits in the two's complement binary representation of the specified {@code long} value.
num::decode(string $string): string
Decodes a string into a integer. Accepts decimal, hexadecimal, and octal numbers
num::format(int|double $number, string $pattern, string $decSep, string $groupSep): string
__construct(): void