PHP ksort() functionThe PHP ksort() sorts an associative array in ascending order, according to the key. It is mainly used for an associative array. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe ksort() function returns true on success and false on failure. Example 1Output: Array ( [ganguly] => 46 [sachin] => 45 [virat] => 29 ) Example 2Output: Array ( [a] => cricket [b] => hockey [c] => football [d] => badminton ) Example 3Output: Array ( [china] =>beijing [france] =>paris [india] =>newdelhi [russia] =>moscow [united kingdom] =>london ) Example 4Output: Array ( [z] => ruby [y] => java [x] => html )
Next TopicPHP Array Functions
|