Hey stackoverflow community,
I'm currently trying to archive an continuous timeline from an array of time periods. My input array looks like this:
$array = array(
0 => array(
'from' => '2019-01-01 00:00:00',
'to' => '2019-03-31 00:00:00'
),
1 => array(
'from' => '2019-02-04 00:00:00',
'to' => '2019-03-15 00:00:00'
));
And the result I'm looking for, is this:
$array = array(
0 => array(
'from' => '2019-01-01 00:00:00',
'to' => '2019-02-03 23:59:59'
),
1 => array(
'from' => '2019-02-04 00:00:00',
'to' => '2019-03-14 23:59:59'
),
2 => array(
'from' => '2019-03-15 00:00:00',
'to' => '2019-03-31 00:00:00'
));
As hard as I'm trying, I'm unable to find a proper solution. Has anyone an idea how to solve this in PHP?