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

PHP进制转换的问题

WBOY
Release: 2016-06-23 14:01:13
Original
931 people have browsed it

比如二进制字符串, 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); //检验一下
Copy after login
Copy after login
ff3f0000

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


版主威武,万分感谢!!!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template