php怎么将八进制转为字符串
- 建站笔记
- 2022-05-09
- 501
转换方法:1、使用base_convert()函数将8进制转为16进制,语法“base_convert(八进制字符串,8,16)”;2、使用hex2bin()函数将16进制转为字符串,语法“hex2bin(16进制值)”。
本教程操作环境:windows7系统、PHP7.1版、DELL G3电脑
php将八进制转为字符串
实现思想:
使用base_convert()函数将8进制转为16进制
使用hex2bin()函数将16进制转为字符串
<?php $oct = "6414533066157"; $hex = base_convert($oct,8,16); $str = hex2bin($hex); echo $str; ?>
说明:
base_convert() 函数在任意进制之间转换数字。
语法:
base_convert(number,frombase,tobase);
hex2bin() 函数把十六进制值的字符串转换为 ASCII 字符,即普通字符串。
语法:
hex2bin(string)
本文由白琉璃于2022-05-09发表在白琉璃源码网,如有侵权或疑问,请联系我们,谢谢。
本文链接:https://www.bailiuli.com/t/3098.html
下一篇
php的注释有几种
发表评论