ksort

PHP 4, PHP 5, PHP 7, PHP 8
ksort - Sort an array by key in ascending order
Ksort Online Tool
Manual
Code Examples

Example #1 ksort example

Result: a = orange b = banana c = apple d = lemon
PHP Version:

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" }
PHP Version:


Example #3 of ksort

PHP Version:


Function ksort:

Arrays Functions

Most used PHP functions