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),
Did you know?Explore Trending and Topic pages for more stories like this.
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

PHP & MS Access - Line Break
Hey Guys!

I'm pulling records from an MS Access database and listing them using PHP and I'm r

Generate multilayered array from string.
ok so i have a string that looks like this:
Code: blog:edit_all,delete_all|users:edit_all,delete_

Strip Slashes Help
I've got a script that i've downloaded of the net to edit multiple fields from my sql database, and

foreach and array need help combining
Hi guys.

Here's the code

Code: array(
'tag' => 'code',<

Pulling out some result data from MYSQL
Hey Guys,

I've built a PHP page that has a for just imagine something like registration form

Need help: how to catch acess of undefined class properties
Hello. I am learning OO with PHP and have hit a problem.
Some code runs as perfectly valid code,

Links not updating
I'm trying to fuel a simple navigation system for a news section. It works fine when it comes to ret

Echo Tweaking help!
HI. I would like to have the output of the entered variables repeat forever, but it's stopping at th

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate,

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