The good version of the class PhpHex2Str
<?php
class PhpHex2Str
{
private $strings;
private static function x_hex2str($hex) {
$hex = substr($hex[0], 1);
$str = '';
for($i=0;$i < strlen($hex);$i+=2) {
$str.=chr(hexdec(substr($hex,$i,2)));
}
return $str;
}
public function decode($strings = null) {
$this->strings = (string) $strings;
return preg_replace_callback('#\%[a-zA-Z0-9]{2}#', 'PhpHex2Str::x_hex2str', $this->strings);
}
}
$obj = new PhpHex2Str;
$strings = $obj->decode($strings);
var_dump($strings);
?>