To sort an array in reverse order in PHP, you can use the rsort()
function. This function sorts the array in descending order.
Here's an example:
main.php89 chars4 lines
Output:
main.php80 chars8 lines
In the above example, we first define an array of fruits. Then we call the rsort()
function to sort the array in reverse order. Finally, we use the print_r()
function to display the sorted array.
gistlibby LogSnag