I have a multidimensional array $output
Array
(
[2015-02-23] =>
Array
(
[0] => Array ( [timestamp] => 2015-02-23T16:00:00 [temp] => -7 [time] => 16)
[1] => Array ( [timestamp] => 2015-02-23T19:00:00 [temp] => -13 [time] => 19)
[2] => Array ( [timestamp] => 2015-02-23T22:00:00 [temp] => -16 [time] => 22)
)
[2015-02-24] =>
Array
(
[0] => Array ( [timestamp] => 2015-02-24T01:00:00 [temp] => -18 [time] => 01)
[1] => Array ( [timestamp] => 2015-02-24T04:00:00 [temp] => -19 [time] => 04)
[2] => Array ( [timestamp] => 2015-02-24T07:00:00 [temp] => -19 [time] => 07)
[3] => Array ( [timestamp] => 2015-02-24T10:00:00 [temp] => -14 [time] => 10)
[4] => Array ( [timestamp] => 2015-02-24T13:00:00 [temp] => -10 [time] => 13)
[5] => Array ( [timestamp] => 2015-02-24T16:00:00 [temp] => -8 [time] => 16)
[6] => Array ( [timestamp] => 2015-02-24T19:00:00 [temp] => -10 [time] => 19)
[7] => Array ( [timestamp] => 2015-02-24T22:00:00 [temp] => -8 [time] => 22)
)
[2015-02-25] =>
Array
(
[0] => Array ( [timestamp] => 2015-02-25T01:00:00 [temp] => -6 [time] => 01)
)
)
How can I create new arrays from the subarrays? So that
$output_0
:
Array
(
[0] => Array ( [timestamp] => 2015-02-23T16:00:00 [temp] => -7 [time] => 16)
[1] => Array ( [timestamp] => 2015-02-23T19:00:00 [temp] => -13 [time] => 19)
[2] => Array ( [timestamp] => 2015-02-23T22:00:00 [temp] => -16 [time] => 22)
)
$output_1
:
Array
(
[0] => Array ( [timestamp] => 2015-02-24T01:00:00 [temp] => -18 [time] => 01)
[1] => Array ( [timestamp] => 2015-02-24T04:00:00 [temp] => -19 [time] => 04)
[2] => Array ( [timestamp] => 2015-02-24T07:00:00 [temp] => -19 [time] => 07)
[3] => Array ( [timestamp] => 2015-02-24T10:00:00 [temp] => -14 [time] => 10)
[4] => Array ( [timestamp] => 2015-02-24T13:00:00 [temp] => -10 [time] => 13)
[5] => Array ( [timestamp] => 2015-02-24T16:00:00 [temp] => -8 [time] => 16)
[6] => Array ( [timestamp] => 2015-02-24T19:00:00 [temp] => -10 [time] => 19)
[7] => Array ( [timestamp] => 2015-02-24T22:00:00 [temp] => -8 [time] => 22)
)
$output_2
:
Array
(
[0] => Array ( [timestamp] => 2015-02-25T01:00:00 [temp] => -6 [time] => 01)
)
I have began with a recursive iterator but can't find the logic in how to build the new arrays from the values gathered with
$iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($output));
foreach ($iterator as $value) {
print strtoupper($value) . " <br>";
}