0
The function preg_replace
is not behaving the way I predicted. By executing the code $string = preg_replace("/[ÁÀÂÃÄáàâãä]/", "a", $string);
what I get back is a string filled with "a"s. If the string has "Áàâäàâäíììì" the answer from preg_replace
is "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaiai". Can you explain to me why this happens? And what is the best way to make this replacement?
Use the flag
u
in regex (logo deopis of the second bar):preg_replace("/[ÁÀÂÃÄáàâãä]/u", "a", $string)
– hkotsubo