If you need to parse utf-8 strings char by char, try this one:
<?php
$utf8marker=chr(128);
$count=0;
while(isset($string{$count})){
if($string{$count}>=$utf8marker) {
$parsechar=substr($string,$count,2);
$count+=2;
} else {
$parsechar=$string{$count};
$count++;
}
/* do what you like with parsechar ... , eg.:*/ echo $parsechar."<BR>\r\n";
}
?>
- it works without mb_substr
- it is fast, because it grabs characters based on indexes when possible and avoids any count and split functions