Let's say i have a string like this: "Sóc Trăng".
What i want to do is check whether ó and ă exist in the string "Sóc Trăng". If those two letters exist in the string, I want to replace ó with o and ă with a.
How can i do so in php?
Let's say i have a string like this: "Sóc Trăng".
What i want to do is check whether ó and ă exist in the string "Sóc Trăng". If those two letters exist in the string, I want to replace ó with o and ă with a.
How can i do so in php?
Simply use str_replace
for it
$str = "Sóc Trăng";
echo str_replace( array('ó', 'ă'), array('o', 'a'), $str);
You can do something like this
$str = "Sóc Trăng";
str_replace("ó","o",$str);
str_replace("ă","a",$str);
Thats it.