In this example I have the word así which ends in the the accented i character.
$str = "A string containing the word así which should be changed to color purple";
$prac[] = "/\basí\b/i";
$prac2[] = "<span class='readword' style='color:purple'>\$0 </span>";
$str= preg_replace($prac,$prac2,$str);
echo $str;
It does not change. But if I have a word that does not end or begin with an accented character it DOES change. For example:
$str = "A string containing another word which should be changed to color
purple";
$prac[] = "/\banother word\b/i";
$prac2[] = "<span class='readword' style='color:purple'>\$0 </span>";
$str= preg_replace($prac,$prac2,$str);
echo $str;
?>
If the accent is in the middle of the word it always works also. Also I tested the array itself and preg_replace itself with the word. There does not appear to be a problem with the word with either the array or preg_replace. It is only when I am using an array as a parameter in preg_replace.
Please help, can't find any information on this anywhere.
Thank you