PHP dechex() Function

Definition and Usage

The dechex() function converts decimal to hexadecimal.

Syntax

dechex(dec_number)
Parameter Description
dec_number Required. Specifies the decimal number to be converted.

Description

Returns a string containing the given binary_string The hexadecimal representation of the parameter. The maximum value that can be converted is 4294967295 in decimal, which results in "ffffffff".

Example

<?php
echo dechex("30");
echo dechex("10");
echo dechex("1587");
echo dechex("70");
?>

Output:

1e
a
633
46