php: alphabetically sort multi-dimensional array by its key?
I'm trying to do the exact same thing as the guy in the thread above me. But my ksort($array) seems to return a number 1. What am I doing wrong?
Have a look at the manual:
bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
You see, ksort returns a boolean value, and directly works on the given array (note the reference sign&). So what you're probably doing is assigning the return value of ksort, like:
$array = ksort($array);
instead of, just:
ksort($array);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With