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 can I sort a multi-dimensional array?


This can easily be done using the function in PHP that is called array_multisort.

Here is an example of this function in action:

<?php

$multiarray 
= array(array(5,4,3,2,1),array(7,8,2,9,10));

array_multisort($multiarray[0],SORT_ASC);

print_r($multiarray);
?>



ASK A QUESTION

More arrays PHP Questions

How do I write my own sort function?

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

How do I generate an associative array like Jan => 10, Feb =>20 etc from a mysql table of 2 columns, month and val ?

im getting a Resource id #5 $rs_comp = mysql_query("select * from company where autoID='$row_settings[compid]'");

How do we sort an array of names taken from a text file, displaying only unique names?



Custom Search