I have an array:
array(2) {
[0]=> array(17) {
[0]=> int(40)
[1]=> int(41)
[2]=> int(199)
[3]=> int(196)
...etc...
}
[1]=> array(17) {
[0]=> 22
[1]=> 66
[2]=> 12
[3]=> 180
...etc...
}
}
I want to sort the array by the second dimension in descending order so that the first dimension is also sorted and maintains the same 'association' by index. The results I want are instead:
array(2) {
[0]=> array(17) {
[0]=> int(196)
[1]=> int(41)
[2]=> int(40)
[3]=> int(199)
...etc...
}
[1]=> array(17) {
[0]=> 180
[1]=> 66
[2]=> 22
[3]=> 12
...etc...
}
}
(I hope I did that correctly.) Yes, I know I can extract these into row->col
format and then use array_multisort but there -has- to be a way to do this more elegantly/directly, right? I'm clearly not getting it.