need help with sorting words by utf-8. For example, we have 5 cities from Belgium.
$array = array(\'Borgloon\',\'Thuin\',\'Lennik\',\'Éghezée\',\'Aubel\');
s
I think you can use strcoll:
setlocale(LC_COLLATE, 'nl_BE.utf8');
$array = array('Borgloon','Thuin','Lennik','Éghezée','Aubel');
usort($array, 'strcoll');
print_r($array);
Result:
Array
(
[0] => Aubel
[1] => Borgloon
[2] => Éghezée
[3] => Lennik
[4] => Thuin
)
You need the nl_BE.utf8 locale on your system:
fy@Heisenberg:~$ locale -a | grep nl_BE.utf8
nl_BE.utf8
If you are using debian you can use dpkg --reconfigure locales to add locales.