I need to sort 2-dimensional array in descending order keeping original indexes:
$arr = array();
for ($i=0; $i<5; $i++) {
$arr[] = array(rand(0,5), rand(10,100));
}
The result must be something like this:
[0] => array(5, 100)
[1] => array(5, 90)
[2] => array(5, 35)
[3] => array(4, 10)
[4] => array(3, 15)
So, firstly, the array is sorted with respect to the 1st column, and, secondly it is sorted with respect to the 2nd column.
The function arsort works with vectors, if I understand it correctly.
How can I solve this task?
see http://docs.php.net/uasort
e.g.
prints