hexdec():hexadecimal equivalent of decimal number

string hexdec(string $hex);
ParameterDESCRIPTION
$hexRequired : $hex string to convert to equivalent decimal number.
The output is decimal number.
Hexadecimal is positional numeral system with base of 16. The chars it used are from 0 to 9 and from A to F.

Example : hexadecimal to decimal

<?Php
echo hexdec('2e'); // Output 46 
echo "<br>";
echo hexdec('2ch'); // Output 44 
echo "<br>";
echo hexdec('fab'); // Output is 4011
echo "<br>";
echo hexdec('FFFFFF'); // Output is 16777215
?>

Checking Hexadecimal inputs

Before using hexdec() to convert hexadecimal to decimal system, we can check hexadecimal input string for a valid hexadecimal number or not by using ctype_xdigit.php function.

Here is Demo of checking and converting Hexadecimal input to decimal base number.

DEMO




plus2net.com




Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer