10进制负数 转 16进制

WBOY
Release: 2016-06-23 14:23:58
Original
1476 people have browsed it

-101 结果 9b

PHP怎么写?


回复讨论(解决方案)

echo dechex(-101);
如要得到9b,需要忽略前面的ff,因为是负数。

echo dechex(-101 & 0xff); //9b

echo dechex(-101);
如要得到9b,需要忽略前面的ff,因为是负数。



echo dechex(-101 & 0xff); //9b


非常感谢~~

echo dechex(-101 & 0xff); //9b 学习!

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!