小白教程
所有教程
关于
Search
172.70.127.160
172.70.127.160
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func math base convert”的源代码
本页内容
上一节:
Func_math_atanh
下一节:
Func_math_bindec
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:base_convert()}}[[Category:PHP Math 数学函数参考手册|9]] = PHP base_convert() 函数 = [[:Category:PHP Math 数学函数参考手册]] 把十六进制数转换为八进制数: <sample title="" desc="" lang="php" hererun="1"> <?php $hex = "E196"; echo base_convert($hex,16,8); ?> </sample> == 定义和用法 == base_convert() 函数在任意进制之间转换数字。 == 语法 == <pre> base_convert(number,frombase,tobase);</pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | number | 必需。规定要转换的数。 |- | frombase | 必需。规定数字原来的进制。介于 2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如 a 表示 10,b 表示 11 以及 z 表示 35。 |- | tobase | 必需。规定要转换的进制。介于 2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如 a 表示 10,b 表示 11 以及 z 表示 35。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | number 转换为指定进制。 |- | 返回类型: | String |- | PHP 版本: | 4+ |} == 更多实例 == == 实例 1 == 把八进制数转换为十进制数: <sample title="" desc="" lang="php" hererun="1"> <?php $oct = "0031"; echo base_convert($oct,8,10); ?> </sample> == 实例 2 == 把八进制数转换为十六进制数: <sample title="" desc="" lang="php" hererun="1"> <?php $oct = "364"; echo base_convert($oct,8,16); ?> </sample> [[:Category:PHP Math 数学函数参考手册]]
返回至“
Func math base convert
”。
上一节:
Func_math_atanh
下一节:
Func_math_bindec