function check_for_overlap($array, $resource, $sourceStart, $sourceEnd, $KeyResource, $tKeyStart, $tKeyEnd){
$out = array();
if(is_array($array)){
foreach ($array as $r){
if ($r[$KeyResource] == $resource){
if($sourceStart < $r[$tKeyEnd] && $sourceEnd > $r[$tKeyStart]){
$out[] = $r;
}
}
}
}
if(count($out) > 0) return true;
}
I would appreciate if someone one would confirm that this will work or if there is a more efficient way to handle this. Thanks!
No to move to the next function.
Don
$lessons = Array
(
[0] => Array
(
[res] => 45
[start] => 2021-07-14 16:00:00
[end] => 2021-07-14 16:45:00
[start_int] => 1626292800
[end_int] => 1626295500
[tdur_slot] => 18
)
[1] => Array
(
[res] => 45
[start] => 2021-07-14 16:45:00
[end] => 2021-07-14 17:30:00
[start_int] => 1626295500
[end_int] => 1626298200
[tdur_slot] => 18
)
[2] => Array
(
[res] => 45
[start] => 2021-07-14 17:30:00
[end] => 2021-07-14 18:30:00
[start_int] => 1626298200
[end_int] => 1626301800
[tdur_slot] => 24
)
[3] => Array
(
[res] => 9
[start] => 2021-07-14 10:00:00
[end] => 2021-07-14 10:45:00
[start_int] => 1626271200
[end_int] => 1626273900
[tdur_slot] => 18
)
)
I am trying to compile two functions to help with scheduling lessons (conflicts and checking for valid availability).
function check_for_overlap($array, $resource, $sourceStart, $sourceEnd, $KeyResource, $tKeyStart, $tKeyEnd){