[thelist] php - sorting multidimensional arrays

Phil Cooper Phil.Cooper at zirconsoftware.co.uk
Tue Sep 28 05:26:17 CDT 2004


I'm new to php and programming in general but am slowly getting there but have now run into a problem that I'm having a hard time trying to solve.  I've googled extensively and have probably come across the answer but failed to recognise it.

Essentially I'm trying to produce a league table.  I have extracted data from the database tables and done some manipulation and have put this data into a multidimensional array.

doing a print_r I get the following:

Array ( [1] => Array ( [team] => Radstock Raiders [gp] => 14 [win] => 5 [loss] => 9 [tie] => 0 [pf] => 1250 [pa] => 1256.5 ) ) 

Array ( [2] => Array ( [team] => Reading Roundheads [gp] => 14 [win] => 8 [loss] => 6 [tie] => 0 [pf] => 1173.5 [pa] => 1173.5 ) )  

Array ( [3] => Array ( [team] => Camberley Celtics [gp] => 14 [win] => 11 [loss] => 2 [tie] => 1 [pf] => 1242 [pa] => 1064 ) )  

What I want do now is do a sort based on the number of wins so I can create an ordered league table and this is what I am struggling with.  Can anyone point me to a good resource that explains, preferably in very simple English, how to do this?

Cheers

Phil


More information about the thelist mailing list