Here's how to use grapheme_extract() to loop across a UTF-8 string character by character.
$str = "سabcक’…";
// if the previous line didn't come through, the string contained:
$n = 0;
for ( $start = 0, $next = 0, $maxbytes = strlen($str), $c = '';
$start < $maxbytes;
$c = grapheme_extract($str, 1, GRAPHEME_EXTR_MAXCHARS , ($start = $next), $next)
echo "This utf8 character is " . strlen($c) . " bytes long and its first byte is " . ord($c) . "\n";
echo "$n UTF-8 characters in a string of $maxbytes bytes!\n";
// Should print: 7 UTF8 characters in a string of 14 bytes!