I have an array in PHP which has associative index values as show below. They are irrelevant to the sorting that I need to do, but I need to keep them. Each value in this array is actually another array which might have 1 to N integers in it, sorted in descending order. However, the integers are written down as text (strings). So the initial data looks something like that:
[10025] => 51, 51, 43, 43, 30, 29, 28, 27, 25, 24, 22, 21
[15671] => 24, 21
[02672] => 24, 26
[76935] => 87, 72, 69, 67, 55, 43, 43, 40, 35, 33, 29
I need to sort this by looking at the maximum value of each secondary array. If the values are equal, I have to look at the second value, etc so finally I'll get something like this:
[76935] => 87, 72, 69, 67, 55, 43, 43, 40, 35, 33, 29
[10025] => 51, 51, 43, 43, 30, 29, 28, 27, 25, 24, 22, 21
[02672] => 24, 26
[15671] => 24, 21
arsort() by default looks at the number of items in each array, which doesn't do the job and raising the SORT_NUMERIC doesn't work either - can't figure out what it does exactly but it doesn't sort the array the way I want.
I've also looked at array_multisort(), however, playing around with it, I couldn't get the desired result either.