num¶
-
php\lib\num
Utils for numbers
Class num
Methods
__construct
()¶private
- static
compare
($num1, $num2)¶Compare two numbers
Примечание
it can be used as comparator for number sorting
Параметры:
- $num1 –
int
,double
- $num2 –
int
,double
Результат:
int
0 if are equal, 1 if $num1 > $num2, -1 if $num1 < $num2
- static
toBin
($number)¶Returns a string representation of the $number argument as an unsigned integer in base 2.
Параметры:
- $number –
int
Результат:
string
- static
toOctal
($number)¶Returns a string representation of the $number argument as an unsigned integer in base 8.
Параметры:
- $number –
int
Результат:
string
- static
toHex
($number)¶Returns a string representation of the $number argument as an unsigned integer in base 16.
Параметры:
- $number –
int
Результат:
string
- static
toString
($number, $radix)¶Returns a string representation of the first argument in the radix specified by the second argument.
Параметры:
- $number –
int
- $radix –
int
Результат:
string
- static
reverse
($number)¶Returns the value obtained by reversing the order of the bits in the two’s complement binary representation of the specified {@code long} value.
Параметры:
- $number –
int
Результат:
int
- static
decode
($string)¶Decodes a string into a integer. Accepts decimal, hexadecimal, and octal numbers
Параметры:
- $string –
string
Результат:
string
or false if invalid number format
- static
format
($number, $pattern, $decSep = '.', $groupSep = ', ')¶
Параметры:
- $number –
int
,double
- $pattern –
- $decSep –
string
- $groupSep –
string
Результат:
string