user10056
user10056

Reputation: 63

php echo without decoding Hex values

I want to output "\x68\x61\061"

$a = "\x68\x61\061"; 
echo $a

This does not result into "\x68\x61\061" in the output. How to fix this?

Upvotes: 1

Views: 100

Answers (1)

letiagoalves
letiagoalves

Reputation: 11302

Escape your special characters, in this case backslashes, with another backslash.

$a = "\\x68\\x61\\061"; 
echo $a;

or use single-quotes instead.

$a = '\x68\x61\061'; 
echo $a;

Reference

Upvotes: 4

Related Questions