如何将PHP十六进制数组转换为ascii? \ X76 \ X52 \ X9

How can I convert a PHP hex array, to ascii? Ex. if I have this string:

$var1="\x76\x52\x9\x3a\x5b\x79";

When I echo it, it appears right, but I'd like to convert it to ascii in the program, so I can do further processing on it & use it further in the script.

You can try this code

<?php
 $var1 = '\x76\x52\x9\x3a\x5b\x79';

echo hexa_string($var1);

function hexa_string($hex_str)
{
$string='';
for ($i=0; $i < strlen($hex_str)-1; $i+=2)
{
    $string .= chr(hexdec($hex_str[$i].$hex_str[$i+1]));
}
return $string;
}
?>

The string is already as you want it. The hex notation is just that: a notation. In reality the string has 6 characters:

echo strlen($var1);

Output:

6

And this:

echo $var1 === "vR\t:[y";

Outputs:

1

Which means they are equal. Note that I still had to escape the tab character with a backslash, but also that is just notation. In reality the tab character is there and is one character.