PHP hexdec

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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 :

  1. echo hexdec("1f")."
    ";  

  2. echo hexdec("b")."
    ";  

  3. echo hexdec("11aa")."
    ";  

  4. echo hexdec("aaccee");  

  5. ?>   

Output :

31
11
4522
11193582