What is the meaning of \\x00 , \\x04 in PHP

≡放荡痞女 提交于 2019-12-02 17:02:17

\x indicates hexadecimal notation. See: PHP strings

Have a look at an ASCII table to see what 0x00 and 0x04 represent.

0x00 = NULL
0x04 = EOT (End of transmission)

\x is a way to indicate that the next two characters represent hexadecimal digits. Two hexadecimal digits (each of them 4 bits) make a byte.

If you want to know what the decimal version is, multiply the left numeral by 16 and add it to the right numeral, keeping in mind that "a" is 10, "b" is 11, etc.

In other programming languages, a dollar sign or the sequence 0x can also be used to flag hexadecimal numbers.


The numbers can represent anything. Sometimes they are control codes. Check an ASCII table.

\x04 is End of Transmission in ASCII. This holds up in most C-like languages.

\xHH is an escape sequence that describes the byte with that hexadecimal value.

So \x00 describes the byte with the value 0, \x04 the byte with the value 4. Note that this escape sequence is only interpolated in double quoted strings.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!