I have the following multidimensional array,
Array
(
[0] => Array
(
[place] => 1
[date] => 2013-01-01
)
[1] => Array
(
[place] => 2
[date] => 2013-01-02
)
[2] => Array
(
[place] => 3
[date] => 2013-01-03
)
[3] => Array
(
[place] => 10
[date] => 2013-01-01
)
[4] => Array
(
[place] => 8
[date] => 2013-01-02
)
[5] => Array
(
[place] => 5
[date] => 2013-01-03
)
)
How can I get the average place each array where the dates match, so the out put array would look like? The most i've been able to do is loop over the arrays extracting the dates which is pretty easy but finding matches and getting the averages is beyond me. Thanks in advance.
Array
(
[0] => Array
(
[place] => 5.5
[date] => 2013-01-01
)
[1] => Array
(
[place] => 5
[date] => 2013-01-02
)
[2] => Array
(
[place] => 6.5
[date] => 2013-01-03
)
)