Given a string like this
$str = '\007\t\007\006\006\t\n\026\r\\\045';
format and output unescaped string so that
\t - tabulation and so on.
I could solve this by using replacements, but maybe there is a better solution?
The best I can think of is:
eval('$str_unescaped = "' . str_replace('"', '\"', $str) . '";');
str_replace is needed in case the string contains any embedded double quotes. But it still gets an error if it contains an embedded \" sequence.
$strhas valid characters that can be decoded. What do you expect to get as decoded string ?