Sort a two dimensional array.


Posted on 16th Feb 2014 07:03 pm by admin

Hi. I've set up a two dimensional array that reads as follows:

Code: $modifiedData = array( array($arrCollingwoodStart[0], $numCollingwoodForTotal, $numCollingwoodAgainstTotal, $numCollingwoodPercentage, $numCollingwoodPointsTotal),
array($arrAdelaideStart[0], $numAdelaideForTotal, $numAdelaideAgainstTotal, $numAdelaidePercentage, $numAdelaidePointsTotal),
array($arrBrisbaneStart[0], $numBrisbaneForTotal, $numBrisbaneAgainstTotal, $numBrisbanePercentage, $numBrisbanePointsTotal),
array($arrCarltonStart[0], $numCarltonForTotal, $numCarltonAgainstTotal, $numCarltonPercentage, $numCarltonPointsTotal));

Each array within represents one row of a table. I need to sort the arrays descending by the variables that end in "PointsTotal", and then by the variables that end in "Percentage". As of yet I haven't worked out how to sort the array out as I want to. Have I set up this array correctly? And if so, how do I peform the sort as I've described?

If anyone can help me out, that would be greatly appreciated

No comments posted yet

Your Answer:

Login to answer
149 Like 36 Dislike
Previous forums Next forums
Other forums

Form errors in an array
I'm processing a form and putting the errors in an array. empty($errors) doesn't seem to do the tric

getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work w

PHP and MySQL Question/Help
I have a MySQL db with all my servers and all their details like server name, IP, OS, RAM etc etc 26

What are causes of a connection-timeout with fopen()?
Hello! Here is the situation: The server I host my website on just upgraded it's PHP build from 4.4.

Am i doing this wrong?
Im pulling from an Oracle database some info... one of which is a field count_pnums which is a NUMBE

Can't seem to capture a variable in a chained select
I'm *this* close to having a chained select running but for some reason it doesn't seem to be pickin

Confused with Loop
guys, i got confused with Looping...this is the case

I have 3 stocks, let say "Stock A&q

Loop Through Date Range
Hi guys,
I have date range as parameter like 01/JAN/2009 TO 16/JAN/2009 now i want to loop thro

Printing issues with xMII 11.5
For some reason, we have one report (and only one) that is giving us fits when trying to print. The

SQL Query/echo not working
Hey all,

I'm trying to run (what I thought) was a simple operation and it isn't working. I h

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash