i've got an array of dates as keys and values (integers) in the form:
[2015-07-14] => 40
[2015-07-15] => 5
[2015-07-16] => 8
[2015-07-17] => 0
[2015-07-18] => 0
[2015-07-19] => 0
[2015-07-20] => 0
[2015-07-21] => 0
[2015-07-22] => 0
[2015-07-23] => 0
[2015-07-24] => 0
[2015-07-25] => 0
[2015-07-26] => 0
[2015-07-27] => 0
[2015-07-28] => 0
[2015-07-29] => 0
[2015-07-30] => 0
[2015-07-31] => 0
[2015-08-01] => 0
[2015-08-02] => 1
[2015-08-03] => 1
[2015-08-04] => 2
[2015-08-05] => 1
The startdate and enddate can be selected by the user.
Is there a quick and easy way to combine those dates and sum the values as per month? In my example, the result should look somethine like:
[2015-07] => 53
[2015-08] => 5
The way that I tried to solve that was to use explode functions and then try to recombine those, but that seems to me a bit more complicated than it needs to be.