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 to point internal pointer to first element of an array?

I have an array of a hundred or so lines, each line has data with "|" separated values. I need to scan through this array, and select the line whose first 5 characters matches a text string. Any ideas or questions?

How can I sort a multi-dimensional array?

How can I sort an array keeping the correlation between the index and value?

How do I return all the values in an array?



Custom Search