I want to create a function that will check if there would be any conflict merging array $blocks into array $schedule:
$schedule = [
'monday' => ['11:00-14:00'],
'tuesday' => ['10:30-12:00', '14:30-17:30'],
...,
];
I would like the function to accept array $blocks and return bool. So let's say I have this $blocks:
$blocks = [
'monday' => ['8:00-10:00', '15:00-16:00'],
'tuesday' => ['12:00-13:00']
]
In this case, the function would return true since there is no conflict in merging $blocks into $schedule.
However, as soon as the function detects any conflict it should return false. For example:
$blocks = [
'monday' => ['8:00-10:00', '15:00-16:00'],
'tuesday' => ['11:00-12:30'],
'wednesday', => [...],
...,
]
So there's no need for $blocks to be iterated further. Since there is already a conflict between $blocks['tuesday'][0] and $schedule['tuesday'][0].
I need help on how to check both time period of string if it collides/overlaps. Any help would be much appreciated. :)