I have a string replacement that includes accented letters. I also used already a normalizer so that I have the same encoding and I cannot remove the diacritics because I need them for my output. My Code:
$word = array("bā","ba");
for($i=0;$i<count($word);$i++)
{
$accented = array("ā","ē","ī","ō","ū");
$last = substr($word[$i],-1);
if ( in_array($last,$accented)) { // replacement of the array with the accented letters
$word[$i] = rtrim("x",$word[$i]);
}
}
How can I modify my code so that it works for accented letters?