array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.hexdec.php', 1 => 'hexdec', ), 'up' => array ( 0 => 'ref.math.php', 1 => 'Math 函数', ), 'prev' => array ( 0 => 'function.fmod.php', 1 => 'fmod', ), 'next' => array ( 0 => 'function.hypot.php', 1 => 'hypot', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/math/functions/hexdec.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4, PHP 5, PHP 7, PHP 8)
hexdec — 十六进制转换为十进制
返回与 hex_string
参数所表示的十六进制数等值的的十进制数。hexdec()
将一个十六进制字符串转换为十进制数。
hexdec() 会忽略它遇到的任意非十六进制的字符。自 PHP 7.4.0 起,弃用使用任何无效字符。
hex_string
要转换的十六进制的字符串
hex_string
十进制的表示
版本 | 说明 |
---|---|
7.4.0 | 传递任何无效字符现在将生成弃用通知。但仍会计算结果,就好像无效字符不存在一样。 |
示例 #1 hexdec() 示例
<?php
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
// both print "int(238)"
var_dump(hexdec("that")); // print "int(10)"
var_dump(hexdec("a0")); // print "int(160)"
?>