It basically comes down to this. I have a string called $name. $name usually has the value ”blablabla”, the value comes from an external resource so that’s why it’s encapsulated in two single quotes. If i would declare this variable myself it would look like this:
$name = "''blablabla''";
I am deleting these single quotes by:
$name[0] = '';
$name[1] = '';
$name[mb_strlen($name, 'UTF-8')-1] = '';
$name[mb_strlen($name, 'UTF-8')-2] = '';
(unsetting the string with a index doesn’t work)
So now I have $name with value “blablabla” without the signle quotes.
Here’s my problem.
When I look at the source code, there are strange characters before the “blablabla”.
How can I deal with this?
And, is there any way to reindex my string (for example what array_values does for arrays)?
EDIT
Eventually I used this code :
$name = mb_substr($name, 2, -2, 'UTF-8');
') are single-byte. Strings in PHP are still binary only, which means, you can just cut it off at the ends.mb_strlendoes not suit to gather the binary index position,strlendoes:.
mb_strlencompared withstrlen