[thelist] php - sorting multidimensional arrays

apathetic timbooker at gmail.com
Tue Sep 28 07:44:22 CDT 2004

On Tue, 28 Sep 2004 12:48:01 +0100, Phil Cooper
<phil.cooper at zirconsoftware.co.uk> wrote:
> Thanks for that - I'll have a read and see if I can understand it.  Would this method allow you to sort say by 'wins' and then by 'pf'?

This should be possible using a custom callback function with usort.

> Not all the data in the arrays is direct from the mysql table.  I had thought about doing the data manipulation and then sending it to a new table and then querying that using ORDER BY but thought it must be possible to do the sorting in php so I didn't have to query the database twice.  Out of interest which method is more programmatically correct?

Neither method is more "correct" than the other, although I prefer to
sort data directly from MySQL where possible, and on a large data set
you will find this more efficient.  In this case, you are doing
subsequent manipulation on the data, so sorting in PHP is more
- Hide quoted text -


www.hyperlinkage.com - Free online RSS news reader

More information about the thelist mailing list