怎么将二进制数转为有符号整数

WBOY
Release: 2016-06-13 12:04:16
Original
1910 people have browsed it

如何将二进制数转为有符号整数
RT,现有1字节二进制数,想转换成8位有符号整数。请问有这样功能的函数吗?hexdec是无符号的。。
------解决方案--------------------
如果你的 $a 是这样来的:$a = bin2hex($b);
那么就

$ar = unpack('c*', $b);
Copy after login

这样就把 $b 按字节转换成用符号整数数组了

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!