PHP hexadec()函数
PHP hexadecimal()函数用于将十六进制数转换为十进制数。它返回十六进制字符串的十进制等价值。
语法
number hexdec ( string $hex_string )
参数 | 描述 | 必需/可选 |
---|---|---|
hex_string | 要转换的十六进制字符串 | 必需 |
示例1
<?php
nos="1e";
echo "Your number is :".nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
输出:
Your number is :1e
By using 'floor()' function your value is:30
示例2
<?php
nos="a";
echo "Your number is :".nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
将下面的英文翻译成中文,不解释,保留HTML格式:
输出:
Your number is :a
By using 'hexdec()' function your value is:10
示例3
<?php
nos="11ff";
echo "Your number is :".nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
输出:
Your number is :11ff
By using 'floor()' function your value is:4607
示例4
<?php
nos="cceeff";
echo "Your number is :".nos;
echo "<br>"."By using 'hexdec()' function your value is:".(hexdec($nos));
?>
输出:
Your number is :cceeff
By using 'hexdec()' function your value is:13430527