PHP dechex()Functions

PHP Math 参考手册PHP Math Reference Manual

Examples

Convert decimal to hexadecimal:

<?php
echo dechex("30") . "<br>";
echo dechex("10") . "<br>";
echo dechex("1587") . "<br>";
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, please seehexdec()function.


Syntax

dechex(number);

Parameter Description
number Required. Specifies the decimal value to be converted.

Technical Details

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


PHP Math 参考手册PHP Math Reference Manual Other Extensions