0

Sort an array with special characters in PHP

Here is my array which needs to be sorted alphabetically. If i have the input: $a = [ 'a', 'u', 'š', 's', 'č', 'c' ]; The output should be: a, c, č, s, š, u AND NOT: a, č, c, š, s, u Thanks for your feedback!

17th Aug 2018, 8:12 AM
Dani
Dani - avatar
2 Respostas
+ 2
Your Array is an associative array So sort your array using asort This will sort the array according to value but if you want to sort it according to keys use ksort.
17th Aug 2018, 10:40 AM
Femi
Femi - avatar
0
https://code.sololearn.com/wSF0W7erG6Gp/?ref=app Not working. I change the input array.
17th Aug 2018, 12:31 PM
Dani
Dani - avatar