w3resource

PHP: hexdec() function

Description

The hexdec() function is used to convert a hexadecimal number to a decimal number.

Version:

(PHP 4 and above)

Syntax:

hexdec(num)

Parameter:

Name Description Required /
Optional
Type
num The hexadecimal string to convert. Required String

Return value:

The decimal representation of num.

Value Type: Integer/Float.

Pictorial Presentation

php math hexdec() function

Example:

<?php
echo hexdec("1f")."<br>";
echo hexdec("b")."<br>";
echo hexdec("11aa")."<br>";
echo hexdec("aaccee");
?> 

Output:

31
11
4522
11193582 

View the example in the browser

See also

PHP Function Reference

Previous: getrandmax
Next: hypot



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/php/function-reference/hexdec.php