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

PHP进制转换的问题

WBOY
WBOYOriginal
2016-06-23 14:01:13900browse

比如二进制字符串, 11111111111111(14个)转换成16进制byte ( FF 3F 00 00 )


又如 11 转换成 03 00 00 00


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


折腾两天了,很急,求大神


回复讨论(解决方案)

$b = '11111111111111';$d = bindec($b);$h = pack('L', $d);echo bin2hex($h); //检验一下
ff3f0000

$b = '11111111111111';$d = bindec($b);$h = pack('L', $d);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