ksort

ksort

(PHP 4, PHP 5, PHP 7)

ksortSort an array by key

Description

bool ksort ( array &$array [, int $sort_flags = SORT_REGULAR ] )

Sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays.

Parameters

array

The input array.

sort_flags

You may modify the behavior of the sort using the optional parameter