PHP krsort() Function

The krsort() function is used to sort an array by key in reverse order. Sorts an array by key in reverse order, maintaining a key to data correlations. The function is useful mainly for associative arrays.The krsort() function sorts an associative array in descending order, according to the key.krsort — Sort an array by key in reverse order

Example -

Example -