I have a double array as follows:
$values[$ids][$dates]
So for each $id I have an array of $dates (which are actual dates in this format – date(“Y-m-d”, $i)).
What I want to do is for each date loop through the corresponding ids and sum them up. So for example, if the first date is “2012-01-01” and the ids are 1,2 and 3. I want
$values[1]["2012-01-01"]+$values[2]["2012-01-01"]+$values[3]["2012-01-01"]
And then I want
$values[1]["2012-01-02"]+$values[2]["2012-01-02"]+$values[3]["2012-01-02"]
preferrably put into an array, which should be trivial. It’s the looping part which is confusing me.
Any ideas? Thanks.
1 Answer