I'm doing some tests and I realized that the string has special characters and counts more than one in substr
.
Example:
$string = "PAÇOCA";
echo strlen($string);
echo substr($string, 0, 3);
I should print: PAÇ
but only print PA
, now if I increase a size from 3 to 4 it prints, and if I take out Ç
and put C
, it counts correctly, so I realize he is considering Ç
as if it were two characters, how can I count them correctly?
I've already tried using mb_string as well. and the header with UTF8.