I have an array containing individual arrays (pulled from db) with content similar to this:
Array
(
[0] => Array
(
[date] => 2014-11
[time] => 2135
[name] => John
)
[1] => Array
(
[date] => 2014-11
[time] => 5496
[name] => Adam
)
[2] => Array
(
[date] => 2014-12
[time] => 1526
[name] => John
)
[3] => Array
(
[date] => 2014-12
[time] => 5481
[name] => Adam
)
[4] => Array
(
[date] => 2014-12
[time] => 3476
[name] => Lizzie
)
)
What I would like to do is to build up a new multi dimensional array based on the previous array, where array's with the same month are joined together in the following way:
Array
(
[0] => Array
(
[date] => 2014-11
[John] => 2135
[Adam] => 5496
)
[1] => Array
(
[date] => 2014-12
[John] => 1526
[Adam] => 5481
[Lizzie] => 3476
)
)
I have tried to look at various array functions, but simply can't get my around on how to achieve this....