LOADING STUFF...

PHP:base_convert()的用法_Math函数

技术教程2小时前更新 北陌
12 0 0

PHP:base_convert()的用法_Math函数

base_convert

(PHP 4, PHP 5)

base_convert — 在任意进制之间转换数字

说明

string base_convert
( string $number
, int $frombase
, int $tobase
)

返回一字符串,包含 number
以 tobase 进制的表示。number
本身的进制由
frombase 指定。frombase
和 tobase 都只能在
2 和 36 之间(包括 2 和 36)。高于十进制的数字用字母 a-z 表示,例如
a 表示 10,b 表示 11 以及 z 表示 35。

Warning

由于使用内部的 “double” 或 “float” 类型,base_convert()
的操作可能会导致大数值中的精度丢失。请参见本手册的
浮点数 章节以便获得更多详细信息。

参数

number

要转换的数字

frombase

The base number is in

tobase

The base to convert number to

返回值

number converted to base tobase

范例

Example #1 base_convert() 例子

$hexadecimal

© 版权声明

相关文章

暂无评论

暂无评论...