I haven’t a clue what is going on but I have a string inside an array. It must be a string as I have ran this on it first:
$array = (string)$array;
If I output $array to the browser in plain text it shows this:
But if I JSON encode $array I get this:
Also, I need to separate the ‘there’ part (the bit after the u0000), but this doesn’t work:
I don’t even know what u0000 is or how to control it in PHP.
I did see this link: Trying to find and get rid of this u0000 from my json
…which suggests str_replacing the JSON that is generated. I can’t do that (and need to separate it as mentioned above first) so I then checked Google for ‘php check for backslash byte’ but I still can’t work out what to do.
uXXXX is the JSON Unicode escape notation (
X is hexadecimal).
In this case, it means the
0 ASCII char, aka the NUL byte, to split it you can either do:
Or better yet:
explode(" ", $array); // PHP doesn't use the same notation as JSON
The string you have is
"hello world", or
"hellox00world" whatever you prefer. If you
echo it, the null symbol