Home > Backend Development > PHP Tutorial > PHP有木有2个十六进制数加减的函数?

PHP有木有2个十六进制数加减的函数?

WBOY
Release: 2016-06-23 14:25:09
Original
938 people have browsed it

0xFFF+Ox33 = ???

诸如此类。

输入结果仍然是十六进制的。


回复讨论(解决方案)

echo (int)dechex(0xFFF + 0x33);

可以直接运算,只是得出的结果还是十进制,你可以使用函数把它们转为字符串类型的十六进制表示。

$hex = '0x' . base_convert(0xFFF+0x33, 10, 16);
Copy after login

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