I want to sort 2d array column-wise consequently, so if the values in one column are equal then sorting is performed by next column. For example array
[[1, 0, 4, 2, 3]
[0, 1, 5, 7, 4]
[0, 0, 6, 1, 0]]
must be sorted as
[[0, 0, 6, 1, 0]
[0, 1, 5, 7, 4]
[1, 0, 4, 2, 3]]
So rows must not be changed, only their order. How can I do that?