I am trying to combine array(s) by key. So all sub arrays that start with the same sub-key will be combined into one sub array. Also, I want to keep the smallest value of the matched values.
Currently this is what I have:
$statement = Array
(
[662_0] => Array
(
[0] => 06-01-2012
[1] => 436
[2] => MEDIA
[3] => 2006
[4] => Template Testing
[5] => KS
[6] => 662
[7] => 0
[8] => 0
[9] => 0
[10] => 0
[11] => 0
[12] => 1290
[13] => 1290.00
[14] => 0.00
[15] => 0
[16] => 1290.00
)
[662_1] => Array
(
[0] => 06-01-2012
[1] => 436
[2] => MEDIA
[3] => 2006
[4] => Template Testing
[5] => KS
[6] => 662
[7] => 295.00
[8] => 0
[9] => 0
[10] => 0
[11] => 0
[12] => 995
[13] => 1290.00
[14] => 0.00
[15] => 0
[16] => 1290.00
)
[662_2] => Array
(
[0] => 06-01-2012
[1] => 436
[2] => MEDIA
[3] => 2006
[4] => Template Testing
[5] => KS
[6] => 662
[7] => 0
[8] => 0
[9] => 0
[10] => 0
[11] => 0
[12] => 1290
[13] => 1290.00
[14] => 0.00
[15] => 0
[16] => 1290.00
)
[663_0] => Array
(
blah blah blah...
)
);
This is what I would like to have:
$statement = Array
(
[662] => Array
(
[0] => 06-01-2012
[1] => 436
[2] => MEDIA
[3] => 2006
[4] => Template Testing
[5] => KS
[6] => 662
[7] => 295.00
[8] => 0
[9] => 0
[10] => 0
[11] => 0
[12] => 995
[13] => 1290.00
[14] => 0.00
[15] => 0
[16] => 1290.00
)
[663] => Array
(
blah blah blah...
)
);
Happy to provide more info if needed! Thanks!!!