in php for decode a hex string we use hex2bin() function
for example "test" in hex is : "74657374"
Now i want to add \x format to them , Like this : \x74\x65\x73\x74
How do i can decode this ?
I wrote a function that removes \x from this string with 'preg_replace' or 'str_replace'
But , Does it has a function in php it self for this ?
I searched but i can't find any good result...
How can i do this in php ?
Kind regards
You don't need to decode/convert the string "\x74\x65\x73\x74" - The PHP interpreter will do it for you using the escape sequence ("\x")
<?php
echo "\x74\x65\x73\x74"; // "test"
?>