Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP dechex() Function

PHP dechex() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Convert decimal to hexadecimal:

"; echo dechex("10") . "
"; echo dechex("1587") . "
"; echo dechex("70"); ?>

Run Example »


Definition and Usage

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

**Tip:** To convert hexadecimal to decimal, see hexdec() function in Vue 3.


Syntax

dechex(

number

);

Parameters Description
number Required. Specifies the decimal value to convert.

Technical Details

Return Value: A string containing the hexadecimal representation of the decimal value.
Return Type: String
PHP Version: 4+

PHP Math Reference Manual PHP Math Reference Manual