Developer Forums | About Us | Site Map
Search  
HOME > PHPMANUAL


Sponsors





Web Host
site hosted by netplex
Partners

Online Manuals

hexdec

(PHP 3, PHP 4 )

hexdec -- Hexadecimal to decimal

Description

int hexdec ( string hex_string)

Returns the decimal equivalent of the hexadecimal number represented by the hex_string argument. hexdec() converts a hexadecimal string to a decimal number. The largest number that can be converted is 7fffffff or 2147483647 in decimal.

hexdec() will replace of any non-hexadecimal characters it encounters by 0. This way, all left zeros are ignored, but right zeros will be valued.

Example 1. hexdec() example

<?php
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
// both print "int(238)"

var_dump(hexdec("that"));
var_dump(hexdec("a0"));
// both print int(160)
 ?>

See also dechex().

Copyright 2004-2024 GrindingGears.com. All rights reserved. Site hosted by NETPLEX