Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

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

where do i get all information like this.

like image 766
coderex Avatar asked Jul 25 '09 19:07

coderex


People also ask

What does \x00 mean?

\x is used to denote an hexadecimal byte. \x00 is thus a byte with all its bits at 0. (As Ryne pointed out, a null character translates to this.) Other examples: \xff is 11111111, \x7f is 01111111, \x80 is 10000000, \x2c is 00101010, etc.

What is the value of x00?

2 Answers. Show activity on this post. A binary file is considered to be just a sequence of bytes - none of them has any special meaning, in the sens that a text-reader would interpret them. \x00 is an example of a specific byte value (HEX 0), that might be interpreted in a special way by a text reader.


1 Answers

\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) 
like image 151
Philippe Gerber Avatar answered Sep 17 '22 07:09

Philippe Gerber