For example, if these were my arrays:
array (4) {
[0] => 6,
[1] => 7,
[2] => 8,
[3] => 9
}
And:
array (4) {
[0] => 10,
[1] => 1,
[2] => 3,
[3] => 5
}
And this array, which I want to sort:
array (4) {
[0] => 'foo1',
[1] => 'foo2',
[2] => 'foo3',
[3] => 'foo4'
}
I would get this for the final result (after sorting):
array (4) {
[0] => 'foo1',
[1] => 'foo4',
[2] => 'foo3',
[3] => 'foo2'
}
Is this possible? Note that I got this final array by sorting the 3rd array provided by the sums of the same keys of the first two arrays.
Any help?
1 Answer