PHP ksort seems to be unaffected by setlocale
I am given an array that needs to be sorted by its key (associative array), and it may contain some accented characters (à, è, ì, etc.). If it helps anyone, I know the language to be used, so I should be able to set the language in theory. So my original theory was to do it like this:
setlocale(LC_COLLATE, 'fre'); ksort($array, SORT_LOCALE_STRING);
It's not like how ksort works at all - accented characters are always in alphabetical order, when I think they should at least come after normal characters. For example, "everyone" will come after "everyone", but not after "justice." So then I started looking in collator but couldn't find a way to sort by array keys. If anyone has any ideas, we would be very grateful.
source to share