Sort rows in multidimensional array

Hello,

I would like 2 know how i must sort an multidimensional array.
The row with the highest number must be on top.(in this case last number in the row).
Are those numbers equal than I want to check another number.
(in this case the 4th number in the row).

How is this be done.
Can anybody help me with this issue.
Any help will be much appreciated.

example data:
0 | 1 | 2 | 3 | 4 | 5
2 | 3 | 4 | 4 | 6 | 7
7 | 6 | 5 | 2 | 3 | 2
1 | 5 | 3 | 1 | 8 | 7
9 | 8 | 7 | 6 | 5 | 4

must be converted in:
1 | 5 | 3 | 1 | 8 | 7
2 | 3 | 4 | 4 | 6 | 7
0 | 1 | 2 | 3 | 4 | 5
9 | 8 | 7 | 6 | 5 | 4
7 | 6 | 5 | 2 | 3 | 2