Let's say I have following string: $string = "Ne, želim ići kući."
Then I split it with preg_split("/[\s,.]+/",$string)
and get an array with every word in the sentence: Array ( [0] => [1] => e [2] => želim [3] => ići [4] => kući [5] => )
How can I now (for every array item) replace all the special characters into standard ascii ones?
Is there an easier method to replace characters like ć and others than the following?
foreach ($array as $element) {
echo str_replace("ć","c",$element);
...
}
Or is there maybe a function which can handle the whole array by itself without any foreach-loops; something like convert_to_ascii($array)
Edit: Because I want to omit the for loop, I think this question is not a duplicate as flagged. My question is regarding a function which can handle and return whole arrays by itself.