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

Using cURL to PUT
Can somebody help with the correct php code to make a cURL PUT request. Here is a sample of code bel

Include with Parameters
In a particular page I would like to include a file that requires $_GET parameters.

when I go

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

Online Event Ticket Sales
Has anyone wrote a script for online tickets sales?

I have been googling and found lots of th

Accept only alpha characters
I've got this bit of code ready for accepting a phrase:

Code: if (!eregi ("", $_POS

Mail sending is slow on server
Why mail is taking time to be send on apache-linux server

Function module "DPS_CHECK_TABLE_EXISTS" not found (after OSS 1422843 impl)
Dear All,

I implemented Note OSS 1422843.

When i execute the new report RSPO20

Can't find a decent web analytics!!!
I've downloaded and installed Piwik. It's location detection based on IP addresses is fairly inaccur

multiple recipients + dbuser mail recall
Hello,

I am building a php login script.

When the user registers the script will send

foreach result into a single variable
Hi,

I have this code...

Code: [Select]foreach ($_POST['Interests'] as $interest =&

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