I just asked this question a moment ago but I asked incorrectly so I apologize.
I'm hoping there's an easy way to do this without tons and tons of loops.
I have a matrix in the following manner:
Foo1 Foo2 Foo3 .... FooN
Jan 1 8 5 4
Feb 10 12 15 11
Mar 12 7 4 3
Apr 10 16 7 17
Assuming the following array:
$arrayMonths = array(
'jan' => array(1, 8, 5,4)
'feb' => array(10,12,15,11)
'mar' => array(12, 7, 4, 3)
'apr' => array(10,16,7,17)
);
I need to sort the above array and show it in the following manner:
array[apr][FooN] = 17
array[feb][Foo3] = 15
array[mar][Foo1] = 12
array[jan][Foo2] = 8
Essentially, I need to get the greatest sum of the above weights, one month can only have one foo and one foo can only have one month. In the above example, the result would be 52.
Thanks