<?PHP/** * PHP calculates whether two time periods have intersection (no boundary overlap) * * @param string $beginTime 1 start time 1 * @param string $endTime 1 End time 1 * @param string $begin Time2 Start Time 2 * @param string $endTime 2 end time 2 * @return bool * @author blog.snsgou.com*/functionIs_time_cross ($beginTime 1= ",$endTime 1= ",$beginTime 2= ",$endTime 2= ' '){ $status=$beginTime 2-$beginTime 1; if($status> 0){ $status 2=$beginTime 2-$endTime 1; if($status 2> 0){ return false; }ElseIf($status 2< 0){ return true; }Else{ return false; } }ElseIf($status< 0){ $status 2=$endTime 2-$beginTime 1; if($status 2> 0){ return true; }Else if($status 2< 0){ return false; }Else{ return false; } }Else{ $status 2=$endTime 2-$beginTime 1; if($status 2= = 0){ return false; }Else{ return true; } }}?>
PHP calculates whether there is a intersection of two time periods (the boundary overlap does not count)