php binary conversion base_convert

 

Converted to hexadecimal octal

base_convert(number,frombase,tobase);

 

 

参数 描述
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。

 

<?php
$hex = "E196"; 
echo base_convert($hex,16,8); 
?>

 

 

reference:

https://www.runoob.com/php/func-math-base-convert.html

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11330266.html