I have a multidimensional array and I need to add up some of the data.
My array looks like this (there is a lot more data I cropped out for the example):
Array
(
[0] => Array
(
[date] => 20-02-2014
[tool] => mystuff1
[usage] => 447
[minutes] => 6705
)
[1] => Array
(
[date] => 20-02-2014
[tool] => mystuff2
[usage] => 20
[minutes] => 1200
)
There will be more than one sub-array that has tool=mystuff1 and I want to add the "minutes" key up for all the ones that have mystuff1. Ultimately I want to do the same with mystuff2 added up (there are other 'tool' keys besides those that will be done as well.)
Ive tried several examples I found on this site but they all seem sum based on the 1 key name i.e. 'minutes' but not anything I can find where I can sum the 'minutes' when 'tool' also matches.