Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dechex(3) [php man page]

DECHEX(3)								 1								 DECHEX(3)

dechex - Decimal to hexadecimal

SYNOPSIS
string dechex (int $number) DESCRIPTION
Returns a string containing a hexadecimal representation of the given unsigned $number argument. The largest number that can be converted is PHP_INT_MAX * 2 + 1 (or -1): on 32-bit platforms, this will be 4294967295 in decimal, which results in dechex(3) returning ffffffff. PARAMETERS
o $number - The decimal value to convert. As PHP's integer type is signed, but dechex(3) deals with unsigned integers, negative integers will be treated as though they were unsigned. RETURN VALUES
Hexadecimal string representation of $number. EXAMPLES
Example #1 dechex(3) example <?php echo dechex(10) . " "; echo dechex(47); ?> The above example will output: a 2f Example #2 dechex(3) example with large integers <?php // The output below assumes a 32-bit platform. // Note that the output is the same for all values. echo dechex(-1)." "; echo dechex(PHP_INT_MAX * 2 + 1)." "; echo dechex(pow(2, 32) - 1)." "; ?> The above example will output: ffffffff ffffffff ffffffff SEE ALSO
hexdec(3), decbin(3), decoct(3), base_convert(3). PHP Documentation Group DECHEX(3)

Check Out this Related Man Page

DECBIN(3)								 1								 DECBIN(3)

decbin - Decimal to binary

SYNOPSIS
string decbin (int $number) DESCRIPTION
Returns a string containing a binary representation of the given $number argument. PARAMETERS
o $number - Decimal value to convert Range of inputs on 32-bit machines +-------------------------------------+--------------------------------------+---+ | positive $number | | | | | | | | | negative $number | | | | | | | | return value | | | | | | +-------------------------------------+--------------------------------------+---+ | 0 | | | | | | | | | | | | | |T{ 0 | | | | | | | 1 | | | | | | | | | | | | | |T{ 1 | | | | | | | 2 | | | | | | | | | | | | | |T{ 10 | | | | | | | | | | | 2147483646 | | | | | | | | | | | | | |T{ 1111111111111111111111111111110 | | | | | | |2147483647 (largest signed integer) | | | | | | | | | | | | | |T{ 1111111111111111111111111111111 | | | | (31 1's) | | | | | | | 2147483648 | | | | | | | | | -2147483648 | | | | | | | | 10000000000000000000000000000000 | | | | | | | | | | | 4294967294 | | | | | | | | | -2 | | | | | | | | 11111111111111111111111111111110 | | | | | | |4294967295 (largest unsigned inte- | | | |ger) | | | | | | | | | -1 | | | | | | | | 11111111111111111111111111111111 (32 | | | | 1's) | | | | | | +-------------------------------------+--------------------------------------+---+ Range of inputs on 64-bit machines +-------------------------------------+------------------------------------------------------------------+---+ | positive $number | | | | | | | | | negative $number | | | | | | | | return value | | | | | | +-------------------------------------+------------------------------------------------------------------+---+ | 0 | | | | | | | | | | | | | |T{ 0 | | | | | | | 1 | | | | | | | | | | | | | |T{ 1 | | | | | | | 2 | | | | | | | | | | | | | |T{ 10 | | | | | | | | | | | 9223372036854775806 | | | | | | | | | | | | | |T{ | | | | 111111111111111111111111111111111111111111111111111111111111110 | | | | | | |9223372036854775807 (largest signed | | | |integer) | | | | | | | | | | | | | |T{ | | | | 111111111111111111111111111111111111111111111111111111111111111 | | | | (63 1's) | | | | | | | | | | | |T{ -9223372036854775808 | | | | | | | | | 1000000000000000000000000000000000000000000000000000000000000000 | | | | | | | | | | | | | | | |T{ -2 | | | | | | | | | 1111111111111111111111111111111111111111111111111111111111111110 | | | | | | | | | | | |T{ -1 | | | | | | | | | 1111111111111111111111111111111111111111111111111111111111111111 | | | | (64 1's) | | | | | | +-------------------------------------+------------------------------------------------------------------+---+ RETURN VALUES
Binary string representation of $number EXAMPLES
Example #1 decbin(3) example <?php echo decbin(12) . " "; echo decbin(26); ?> The above example will output: 1100 11010 SEE ALSO
bindec(3), decoct(3), dechex(3), base_convert(3), printf(3), using %b, %032b or %064b as the format , sprintf(3), using %b, %032b or %064b as the format . PHP Documentation Group DECBIN(3)
Man Page