I need a way to check if there are events that overlap each other. So I made an array with the start and end hour of every event. It looks like this:
Array
(
[0] => Array
(
[start] => 0930
[end] => 1200
)
[1] => Array
(
[start] => 1000
[end] => 1230
)
[2] => Array
(
[start] => 1300
[end] => 1530
)
)
This is what I've tried to check if there are events that overlap:
if ( $orders->have_posts() ):
while ($orders->have_posts()) : $orders->the_post();
foreach($order as $o){
$start = $o['start'];
$end = $o['end'];
$attractieID = $o['attractie']->ID;
foreach($order as $key => $attractieID){
$slots[] = array('start' => $start, 'end' => $end);
if($start < $end){
//overlap
}else{
//no overlap
}
}
}
endwhile;
endif;
But this will always give true since I am checking the start and end date of the same item in my array.
I need to way to compare the start value of the current array item and the end value of the previous array item
Anyone knows if this is even possible?
Many thanks in advance!
ifwith{and end it withendif.