I have an array that was created from a CSV file. The array contains the following. Basically it has four lines and six columns. I.E. it is multi dimensional.
Array (
[1] => Array (
[WBS Element] => 1234567.01
[Proj System Status] =>
[CY Actuals] => 579373
[ITD Actuals] => 696,609
[Overall Commitment] =>
[Overall Assigned] => 696,609
[CYSpent] => 579,373 )
[2] => Array (
[WBS Element] => 1234567.02
[Proj System Status] =>
[CY Actuals] => 86689
[ITD Actuals] => 86,689
[Overall Commitment] =>
[Overall Assigned] => 86,689
[CYSpent] => 86,689 )
[3] => Array (
[WBS Element] => 1234567.02.01
[Proj System Status] =>
[CY Actuals] => 10750
[ITD Actuals] => 86,689
[Overall Commitment] =>
[Overall Assigned] => 86,689
[CYSpent] => 86,689 )
[4] => Array (
[WBS Element] => 1234567.02.02
[Proj System Status] =>
[CY Actuals] => 22756
[ITD Actuals] => 86,689
[Overall Commitment] =>
[Overall Assigned] => 86,689
[CYSpent] => 86,689 )
)
You will notice that one of my keys "WBS Element" has a value in it where the first ten characters might match another row in the array. What I need to accomplish is to take any row where the first ten characters of the "WBS Element" match and sum the other columns together so that the result is a aggregated array with the same columns but no rows with the first ten characters matching.
Hopefully that makes sense what I am trying to accomplish. I am new when it comes to PHP so any help would be appreciated. I ahve gotton a column summerization to work but I can't figure out to search an array for "matching" keys then combine those together by summing.
Thanks in advance!