PHP krsort() functionThe PHP krsort( ) function is used to sort the array elements by the key in descending order. It is mainly used in the associative array. This function was introduced in PHP 4.0. SyntaxParameter
ReturnsThe krsort( ) function returns true on success or false on failure. Example 1Output: Array ( [punjab] =>chandigarh [karnataka] =>bangalore [jharkhand] =>ranchi [goa] =>panaji [bihar] =>patna ) Example 2Output: Array ( [d] => volleyball [c] => hockey [b] => football [a] => cricket ) Example 3Output: Array ( [z] =>php [y] => java [x] => html ) Example 4Output: Array ( [virat] => 29 [sachin] => 45 [ganguly] => 46 )
Next TopicPHP Array Functions
|