How to replace UTF-8 codes in a PHP string with real characters?

Solution:

Since this is a single byte-escaping string, you can convert them by using a regular expression:

echo preg_replace("#(\\\x[0-9A-F]{2})#e", "chr(hexdec('\\1'))", $var);