My question is: In PHP it is easy to refer to a single byte string, $single = "abc"; eg,
echo $single[0];
However, for the multi-byte string $multi = "Γ€Γ₯ΓΆ" I get "nonsense", that is
echo $multi[0];
I know that it is possible to refer to individual letters of a multibyte string by encoding as follows:
mb_internal_encoding("UTF-8"); echo mb_substr($multi,1,1);//which gives the right answer "Γ₯"
But isn't there an easier way to do this? I am especially looking for a way that I can refer to a string with several bytes with square brackets and only one parameter, as is the case with one byte.
source share