I have an array that holds the names of languages in spanish:
$lang["ko"] = "coreano"; //korean
$lang["ar"] = "árabe"; //arabic
$lang["es"] = "español"; //spanish
$lang["fr"] = "francés"; //french
I need to order the array and maintain index association, so I use asort() with the SORT_LOCALE_STRING
setlocale(LC_ALL,'es_ES.UTF-8'); //this is at the beginning (config file)
asort($lang,SORT_LOCALE_STRING);
print_r($lang);
The expected output would be in this order:
- Array ( [ar] => árabe [ko] => coreano [es] => español [fr] => francés )
However, this is what I'm receiving:
- Array ( [ko] => coreano [es] => español [fr] => francés [ar] => árabe )
Am I missing something? Thanks for your feedback! (my server is using PHP Version 5.2.13)
c
comes beforeá
? – Pebblesetlocale
? Most probably it simply failed. – Bolger