PHP中\x00、\x04的含义是什么

时间:2022-05-27 11:42:27

i have some codes having the \x00 and \x04 hex codes, what does it means?

我有一些代码有\x00和\x04十六进制代码,这是什么意思?

$str= implode("\x00", $var['message']); //line 1
$id= $var['message'] . "\x04" . $id;    //line 2

what will happen in the line1 and line2 I want to write these into a external file as binary format.

在第1行和第2行中会发生什么?我想将它们作为二进制格式写入外部文件中。

where do i get all information like this.

我从哪里得到这样的信息。

5 个解决方案

#1


51  

\x indicates hexadecimal notation. See: PHP strings

\ x表示十六进制符号。看:PHP字符串

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

看一下ASCII表,看看0x00和0x04代表什么。

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

#2


8  

\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.

\x是表示后面两个字符表示十六进制数字的一种方式。两个十六进制数字(每个为4位)构成一个字节。

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.

如果你想知道小数形式是什么,把左边的数字乘以16,把它加到右边的数字中,记住“a”是10,“b”是11,等等。

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

在其他编程语言中,美元符号或序列0x也可以用来标记十六进制数字。


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

这些数字可以代表任何东西。有时它们是控制代码。检查一个ASCII表。

#3


2  

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

\x04是ASCII传输的结束。这在大多数类c语言中都适用。

#4


1  

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

\xHH是一个转义序列,它用十六进制值来描述字节。

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.

所以\x00用值0来描述字节,\x04用值4来描述字节。注意,这个转义序列只在双引号字符串中进行插值。

#5


1  

\x00 is a Null-character
\x04 is a End-of-transmission-character

\x00是一个空字符\x04是一个传输结束字符

#1


51  

\x indicates hexadecimal notation. See: PHP strings

\ x表示十六进制符号。看:PHP字符串

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

看一下ASCII表,看看0x00和0x04代表什么。

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

#2


8  

\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.

\x是表示后面两个字符表示十六进制数字的一种方式。两个十六进制数字(每个为4位)构成一个字节。

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.

如果你想知道小数形式是什么,把左边的数字乘以16,把它加到右边的数字中,记住“a”是10,“b”是11,等等。

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

在其他编程语言中,美元符号或序列0x也可以用来标记十六进制数字。


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

这些数字可以代表任何东西。有时它们是控制代码。检查一个ASCII表。

#3


2  

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

\x04是ASCII传输的结束。这在大多数类c语言中都适用。

#4


1  

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

\xHH是一个转义序列,它用十六进制值来描述字节。

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.

所以\x00用值0来描述字节,\x04用值4来描述字节。注意,这个转义序列只在双引号字符串中进行插值。

#5


1  

\x00 is a Null-character
\x04 is a End-of-transmission-character

\x00是一个空字符\x04是一个传输结束字符