Query: dechex
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
DECHEX(3) 1 DECHEX(3) dechex - Decimal to hexadecimalSYNOPSISstring dechex (int $number)DESCRIPTIONReturns 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.PARAMETERSo $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 VALUESHexadecimal string representation of $number.EXAMPLESExample #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 ffffffffSEE ALSOhexdec(3), decbin(3), decoct(3), base_convert(3). PHP Documentation Group DECHEX(3)
Related Man Pages |
---|
round(3) - php |
dechex(3) - php |
base_convert(3) - php |
crc32(3) - php |
ctype_xdigit(3) - php |
Similar Topics in the Unix Linux Community |
---|
mathematics operations in unix |
Evaluating Decimal values |
Hexadecimal to Decimal |
Division returning a negative number |
Splitting string and storing in int |