I am doing a project for school and had to create a function to check if 2 time ranges overlap. I searched the net a bit but failed to find a simple function to do that. I played around a bit with my code and I think I created a working one.Note: it works for 24 hour times only & don't forget the 0 in front of AM time e.g 08:15If anyone has a better function to do this or finds some bugs in the code below - please post below.Here is the code you can test directly on.$start_time1 = 10:15;$end_time1 = 12:20;$start_time2 = 13:15;$end_time2 = 14:25;function testRange($start_time1,$end_time1,$start_time2,$end_time2){    $timeCheck;    if(($end_time1 < $start_time2))    {        $timeCheck = true;        return $timeCheck;    }    else if(($start_time1 > $start_time2) && ($start_time1 > $end_time2))     {        $timeCheck = true;        return $timeCheck;    }    else    {        $timeCheck = false;        return $timeCheck;    }}if(testRange($start_time1,$end_time1,$start_time2,$end_time2)){    echo Not In Range;}else{    echo In Range;}
Test 2 time ranges to see if they overlap
php;interval