PHP Questions Home
Categories
Arrays
Files
Forms
Creating PDFs
PHP Errors
Functions
Images
MySQL
Numbers
Others
Strings
Website

PHP Forums
Forums Index
MySQL Forum
PHP Forum
Flash/Actionscript
Javascript
Web design

More PHP
PHP Functions
Top Questions
Ask a Question
PHP Interview Questions
PHP Jobs
Ecommerce
IT Questions
Business Websites

Sponsors

sponsor ad
My Salary
PHP Developer Salary
Advertise Here

How do I reverse sort the members of an array?


If you wish to reverse sort the members of an array by their values, then you need to use rsort, for reverse sort, instead of sort.

Again this takes the name of the array as its parameter and here's a little example for you:

<?php
$myworld 
= array("it","better","make","you");
rsort($myworld);
print_r($myworld);
?>


printing to the screen:

Array
(
[0] => you
[1] => make
[2] => it
[3] => better
)



ASK A QUESTION

More arrays PHP Questions

how can you reset an array in PHP

How do I add to the end of an array and know how large the array is?

How can I loop through the members of an array?

reverse an array

How do I sort an array by key?



Custom Search