How to display the following array string in alphabetically without using the collator method
$country = array('Ägypten','Afghanistan', 'Äquatorialguinea', 'Albanien');
My code is:
function compareASCII($a, $b) {
$a1 = iconv('UTF-8', 'ASCII//TRANSLIT', $a);
$b1 = iconv('UTF-8', 'ASCII//TRANSLIT', $b);
return strcmp($a1, $b1);
}
usort($country, 'compareASCII');
Output:
Array ( [0] => Ägypten [1] => Äquatorialguinea [2] => Afghanistan [3] => Albanien )
Expected Output:
Array ( [0] => Afghanistan [1] => Ägypten [2] => Albanien [3] => Äquatorialguinea )
How to get expected output?
Thanks for advance!!!