ksort
PHP 4, PHP 5, PHP 7, PHP 8
ksort - Sort an array by key in ascending order
Example #1 ksort example
Result: a = orange
b = banana
c = apple
d = lemon
Example #2 ksort with <span class='function-type'>int</span> keys
Result: array(3) {
[0]=>
string(5) "First"
[2]=>
string(4) "Last"
[1]=>
string(6) "Middle"
}
array(3) {
[0]=>
string(5) "First"
[1]=>
string(6) "Middle"
[2]=>
string(4) "Last"
}
Example #3 of ksort