I have a multidimensional array, that I'm sorting alphabetically, but problem is, with danish special characters æ ø å. They should be sorted in that order, but is not returned in that order.
This is my array (part of is removed)
Array
(
[0] => Array
(
[Name] => John
)
[1] => Array
(
[Name] => Pater
)
[2] => Array
(
[Name] => Allan
)
[3] => Array
(
[Name] => Ø test
)
[4] => Array
(
[Name] => Å test
)
[5] => Array
(
[Name] => Æ test
)
)
I'm using this function to sort it
uasort($sorted_region, function($a, $b) {
$retval = $a['Name'] <=> $b['Name'];
return $retval;
});
Anyone know, how to sort it, so I get æ ø å in the right order?
I've seen some using e.g.
setlocale(LC_COLLATE, 'da_DK.utf8');
asort($array, SORT_LOCALE_STRING);
But I'm not sure how to implement this in a multidimensional array.
Thanks for any help! :-)