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

Help With Showing Users On the Index Page
Ive got this code which works just how i want it to.

Code: <?
$timenow=time();

On page view, minus credit
Hello all, please, I need a little help with this script. I am charging one credit (credits can be p

couldn't connect to your database
Hello I am new to php mysql

Actually i have read A tutorial on nettuts
"http://net.tu

Time script, set to my time zone?
I am using this line to get the date and time

Code: $time = date(F." ".d.", &q

Setting condidtions for an input box
Hi all,

I would like to set a condition in a txt box that says the number a user enters has t

why is it over writing
Code: $filepaths[] = $_FILES['new_image'];
foreach ($filepaths as $filepath)
{
$imagename =

Code working in IE but not FireFox
I created a dynamic navigation list for my website based off of a table in my database. The code is

Count Session and Trigger Events
I am New in PHP, seeking a method to count logged users by counting the sessions or any …, is

Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

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