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

sort

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

OK I've been trying to echo out the arrays "$people and $other people" using the for-each method in alphabetical order. but when i see what this displays it does it in some other order. THIS IS THE CODE PHP Ch8 Lab

Translation Composition Nationalism European Grammar Arabic Poetry Prose ******************************* I want an array equation that helps me to calculate some of varibles unspecific

reverse an array



Custom Search