PHP dechex() Function

The dechex() function converts a decimal number to a hexadecimal number.

string dechex ( int $number )

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() returning ffffffff.

Examples -

Example #1 dechex() example

Example #2 dechex() example with large integers

ParameterDescription
numberThe decimal value to convert.