Home  >  Article  >  Backend Development  >  PHP进制转换的有关问题

PHP进制转换的有关问题

WBOY
WBOYOriginal
2016-06-13 11:50:191202browse

PHP进制转换的问题

本帖最后由 qq85168163 于 2014-03-10 14:13:19 编辑 比如二进制字符串, 11111111111111(14个)转换成16进制byte ( FF 3F 00 00 )


又如 11 转换成 03 00 00 00


应该怎么转换,是不是要用到pack函数?求实例!!!


折腾两天了,很急,求大神
------解决方案--------------------
$b = '11111111111111';<br />$d = bindec($b);<br />$h = pack('L', $d);<br /><br />echo bin2hex($h); //检验一下
ff3f0000
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn