hexdec():decimal equivalent of hexadeciam number

<?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
?>
Syntax
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.

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





Math Functions dechex(): Convert decimal number to hexadecimal system
base_convert(): Convert number From any base to other decbin() Binary equivalent of decimal number
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





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