10进制负数 转 16进制,该怎么解决

WBOY
Release: 2016-06-13 11:46:33
Original
1855 people have browsed it

10进制负数 转 16进制
-101 结果 9b

PHP怎么写?
------解决方案--------------------
echo dechex(-101);
如要得到9b,需要忽略前面的ff,因为是负数。
------解决方案--------------------
echo dechex(-101 & 0xff); //9b

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