Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to replace special characters with accents within multi dimensional associative arrays to normalized/latin ones in php?
    text
    copied!<p>This is a follow up question from this one: <a href="https://stackoverflow.com/questions/20563369/how-to-remove-spaces-in-array-keys-names-in-php/20563507?noredirect=1#20563507">How to remove spaces in array keys names in php?</a></p> <p>Basically this function works perfectly:</p> <pre><code>function fixArrayKey(&amp;$arr) { $arr=array_combine(array_map(function($str){return str_replace(array(" ",",",".","-","+"),"",$str);},array_keys($arr)),array_values($arr)); foreach($arr as $key=&gt;$val) { if(is_array($val)) fixArrayKey($arr[$key]); } } </code></pre> <p>But when I add all the special characters I want to replace, it still works but does not replace/remove any of the special/accented charaters:</p> <pre><code>function fixArrayKey(&amp;$arr) { $arr=array_combine(array_map(function($str){return str_replace(array(" ",",",".","-","+", "á", "Á", "à", "À", "ă", "Ă", "â", "Â", "å", "Å", "ã", "Ã", "ą", "Ą", "ā", "Ā", "ä", "Ä", "æ", "Æ", "ḃ", "Ḃ", "ć", "Ć", "ĉ", "Ĉ", "č", "Č", "ċ", "Ċ", "ç", "Ç", "ď", "Ď", "ḋ", "Ḋ", "đ", "Đ", "ð", "Ð", "é", "É", "è", "È", "ĕ", "Ĕ", "ê", "Ê", "ě", "Ě", "ë", "Ë", "ė", "Ė", "ę", "Ę", "ē", "Ē", "ḟ", "Ḟ", "ƒ", "Ƒ", "ğ", "Ğ", "ĝ", "Ĝ", "ġ", "Ġ", "ģ", "Ģ", "ĥ", "Ĥ", "ħ", "Ħ", "í", "Í", "ì", "Ì", "î", "Î", "ï", "Ï", "ĩ", "Ĩ", "į", "Į", "ī", "Ī", "ĵ", "Ĵ", "ķ", "Ķ", "ĺ", "Ĺ", "ľ", "Ľ", "ļ", "Ļ", "ł", "Ł", "ṁ", "Ṁ", "ń", "Ń", "ň", "Ň", "ñ", "Ñ", "ņ", "Ņ", "ó", "Ó", "ò", "Ò", "ô", "Ô", "ő", "Ő", "õ", "Õ", "ø", "Ø", "ō", "Ō", "ơ", "Ơ", "ö", "Ö", "ṗ", "Ṗ", "ŕ", "Ŕ", "ř", "Ř", "ŗ", "Ŗ", "ś", "Ś", "ŝ", "Ŝ", "š", "Š", "ṡ", "Ṡ", "ş", "Ş", "ș", "Ș", "ß", "ť", "Ť", "ṫ", "Ṫ", "ţ", "Ţ", "ț", "Ț", "ŧ", "Ŧ", "ú", "Ú", "ù", "Ù", "ŭ", "Ŭ", "û", "Û", "ů", "Ů", "ű", "Ű", "ũ", "Ũ", "ų", "Ų", "ū", "Ū", "ư", "Ư", "ü", "Ü", "ẃ", "Ẃ", "ẁ", "Ẁ", "ŵ", "Ŵ", "ẅ", "Ẅ", "ý", "Ý", "ỳ", "Ỳ", "ŷ", "Ŷ", "ÿ", "Ÿ", "ź", "Ź", "ž", "Ž", "ż", "Ż", "þ", "Þ", "µ", "а", "А", "б", "Б", "в", "В", "г", "Г", "д", "Д", "е", "Е", "ё", "Ё", "ж", "Ж", "з", "З", "и", "И", "й", "Й", "к", "К", "л", "Л", "м", "М", "н", "Н", "о", "О", "п", "П", "р", "Р", "с", "С", "т", "Т", "у", "У", "ф", "Ф", "х", "Х", "ц", "Ц", "ч", "Ч", "ш", "Ш", "щ", "Щ", "ъ", "Ъ", "ы", "Ы", "ь", "Ь", "э", "Э", "ю", "Ю", "я", "Я"),"",$str);},array_keys($arr)),array_values($arr)); foreach($arr as $key=&gt;$val) { if(is_array($val)) fixArrayKey($arr[$key]); } } </code></pre> <p>Does anyone know why ? And how to solve my problem?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload