Home  >  Article  >  Backend Development  >  PHP echo十六进制数值

PHP echo十六进制数值

WBOY
WBOYOriginal
2016-06-23 14:10:382351browse

<?phpecho 0x9f;?>

运行程序输出159。
159的16进制是9f,为什么前面要加0x呢?
还有这里为什么可以直接输出一个16进制数值而不是报错呢?


回复讨论(解决方案)

所有的从 C 派生的源都是这么表示的,如果非要究个为什么,那就要去问贝尔电话实验室了

十六进制(Hex number system)不取 H (不过basic 是取 H 的)反而要取 x ,可见老外也不是很守“规矩”的

这是c的错,让你不解,就接受吧

Statement:
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