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 Hexadecimal representation of parameters. The maximum number that can be converted is decimal 4294967295, the result is "ffffffff".

Example

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

Output:

1e
a
633
46