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 sort the members of an array by value?


If you wish to sort the members of an array by value - which is probably one of the most common requirements with arrays as we tend to like to order things, use the sort function.

This takes the array as its parameter, as in sort($array).

Here's a simple example:

<?php
$myworld 
= array("world","hello");
sort($myworld);
print_r($myworld);
?>


Which looks a little like this:

Array
(
[0] => hello
[1] => world
)



ASK A QUESTION

More arrays PHP Questions

HOW CAN I DELETE ALL THE ELEMENT OF THE ARRAY

How do I reverse sort an array by key?

How do I check if a variable is of array type?

reverse an array

i need to store a multi-dimensioned array into a file. there is plenty of info. on creating md-arrays but i cant find anything on writing a md-array to a file.



Custom Search