I have an array created in PHP which is used downstream in a Garmin connectIQ app. I have created a script which generates the below Var_export
array (
'2022-05-14' =>
array (
0 =>
array (
'index' => 0,
'time' => '05:18:31',
'timeE' => 1652501911,
'type' => 'High',
'height' => '7.9m',
'diff' => '1day 15hrs',
),
1 =>
array (
'index' => 1,
'time' => '11:39:16',
'timeE' => 1652524756,
'type' => 'Low',
'height' => '1.3m',
'diff' => '1day 8hrs',
),
2 =>
array (
'index' => 2,
'time' => '17:43:49',
'timeE' => 1652546629,
'type' => 'High',
'height' => '8m',
'diff' => '1day 2hrs',
),
3 =>
array (
'index' => 3,
'time' => '23:57:31',
'timeE' => 1652569051,
'type' => 'Low',
'height' => '1.2m',
'diff' => '20hrs 27mins',
),
),
'2022-05-15' =>
array (
4 =>
array (
'index' => 4,
'time' => '06:02:02',
'timeE' => 1652590922,
'type' => 'High',
'height' => '8.3m',
'diff' => '14hrs 22mins',
),
5 =>
array (
'index' => 5,
'time' => '12:22:53',
'timeE' => 1652613773,
'type' => 'Low',
'height' => '1m',
'diff' => '8hrs 2mins',
),
6 =>
array (
'index' => 6,
'time' => '18:26:19',
'timeE' => 1652635579,
'type' => 'High',
'height' => '8.4m',
'diff' => '1hr 58mins',
),
),
)
However, what I need, is the output to be re-indexed on each date change
array (
'2022-05-14' =>
array (
0 =>
array (
'index' => 0,
'time' => '05:18:31',
'timeE' => 1652501911,
'type' => 'High',
'height' => '7.9m',
'diff' => '1day 15hrs',
),
1 =>
array (
'index' => 1,
'time' => '11:39:16',
'timeE' => 1652524756,
'type' => 'Low',
'height' => '1.3m',
'diff' => '1day 8hrs',
),
2 =>
array (
'index' => 2,
'time' => '17:43:49',
'timeE' => 1652546629,
'type' => 'High',
'height' => '8m',
'diff' => '1day 2hrs',
),
3 =>
array (
'index' => 3,
'time' => '23:57:31',
'timeE' => 1652569051,
'type' => 'Low',
'height' => '1.2m',
'diff' => '20hrs 27mins',
),
),
'2022-05-15' =>
array (
0 =>
array (
'index' => 4,
'time' => '06:02:02',
'timeE' => 1652590922,
'type' => 'High',
'height' => '8.3m',
'diff' => '14hrs 22mins',
),
1 =>
array (
'index' => 5,
'time' => '12:22:53',
'timeE' => 1652613773,
'type' => 'Low',
'height' => '1m',
'diff' => '8hrs 2mins',
),
2 =>
array (
'index' => 6,
'time' => '18:26:19',
'timeE' => 1652635579,
'type' => 'High',
'height' => '8.4m',
'diff' => '1hr 58mins',
),
),
)
I have been unable to figure this one out and my searches are coming up short. Appreciate any guidance offered