English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The krsort() function sorts the array in reverse order by key name
krsort ( $array, $sort_flag );
The krsort() function sorts the array in reverse order by key. These values retain their original keys.
Serial Number | Parameters and Description |
---|---|
1 | array(Required) It specifies an array |
2 | sort_flag(Optional) It specifies how to sort the array values. Possible values-
|
This function returns TRUE on success and FALSE on failure.
<?php $transport = array( 'a'=>'foot', 'b'=>'bike', 'c'=>'car', 'd'=>'plane'); krsort($transport); print_r($transport); ?>Test and see‹/›
Output Result:
Array ( [d] => plane [c] => car [b] => bike [a] => foot )