I have the following array:
Array ( [0] => Array ( [0] => 155 [1] => 480 [2] => 1020 )
[1] => Array ( [0] => 153 [1] => 480 [2] => 525 )
[2] => Array ( [0] => 156 [1] => 480 [2] => 510 )
[3] => Array ( [0] => 139 [1] => 510 [2] => 580 )
[4] => Array ( [0] => 152 [1] => 510 [2] => 600 )
[5] => Array ( [0] => 154 [1] => 570 [2] => 780 )
[6] => Array ( [0] => 133 [1] => 585 [2] => 630 )
[7] => Array ( [0] => 150 [1] => 660 [2] => 810 )
[8] => Array ( [0] => 157 [1] => 660 [2] => 720 )
[9] => Array ( [0] => 149 [1] => 780 [2] => 840 )
[10] => Array ( [0] => 151 [1] => 900 [2] => 975 ) )
I got the above by using usort on column [1] so that column 1 values are ascending. I want to sort it again, this time on column [2] so that the column [1] is ascending and column [2] is descending.
For example, for this array rows 3 and 4 would become:
[3] => Array ( [0] => 152 [1] => 510 [2] => 600 )
[4] => Array ( [0] => 139 [1] => 510 [2] => 580 )
I've been reading about all the sorting functions, but there doesn't seem to be one that works like this. I've also tried writing my own, but so far haven't gotten the logic correct.
Any help would be much appreciated.
Thanks very much.
B