Skip to content

Latest commit

 

History

History
133 lines (93 loc) · 2.6 KB

File metadata and controls

133 lines (93 loc) · 2.6 KB

num

  • class num (php\lib\num)
  • package std
  • source php/lib/num.php

Child Classes

number

Description

Utils for numbers

Class num


Static Methods

  • num ::compare() - Compare two numbers
  • num ::toBin() - Returns a string representation of the $number
  • num ::toOctal() - Returns a string representation of the $number
  • num ::toHex() - Returns a string representation of the $number
  • num ::toString() - Returns a string representation of the first argument in the
  • num ::reverse() - Returns the value obtained by reversing the order of the bits in the
  • num ::decode() - Decodes a string into a integer.
  • num ::format()

Methods


Static Methods

compare()

num::compare(int|double $num1, int|double $num2): int

Compare two numbers

.. note:: it can be used as comparator for number sorting


toBin()

num::toBin(int $number): string

Returns a string representation of the $number argument as an unsigned integer in base 2.


toOctal()

num::toOctal(int $number): string

Returns a string representation of the $number argument as an unsigned integer in base 8.


toHex()

num::toHex(int $number): string

Returns a string representation of the $number argument as an unsigned integer in base 16.


toString()

num::toString(int $number, int $radix): string

Returns a string representation of the first argument in the radix specified by the second argument.


reverse()

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.


decode()

num::decode(string $string): string

Decodes a string into a integer. Accepts decimal, hexadecimal, and octal numbers


format()

num::format(int|double $number, string $pattern, string $decSep, string $groupSep): string

Methods

__construct()

__construct(): void