PHP dechex() - Math Functions

What is dechex Function?
How to convert decimal number to hexadecimal in PHP?

Explanation

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

Syntax:


dechex(dec_number)

In the above syntax "dec_number" is the decimal number to converted to hexadecimal number.

Example :


<?php
echo dechex(10). "n";
echo dechex(47);
?>
Result :

a
2f

In the above example the decimal numbers "10", "47" are converted to hexadecimal numbers "a", "2f".

PHP Topics


Ask Questions

Ask Question