Home >Backend Development >PHP Tutorial >PHP function to compare whether time period one and time period two intersect
Copy the code The code is as follows:
/*
*Compare time period one and time period two to see if there is an intersection
*/
function isMixTime($begintime1,$endtime1,$begintime2,$endtime2)
{
$status = $begintime2 - $begintime1;
if($status>0){
$status2 = $begintime2 - $endtime1;
if($status2>0){
return false;
}else{
return true;
}
}else{
$status2 = $begintime1 - $endtime2;
if($status2>0){
return false;
}else{
return true;
}
}
}
The above has introduced the PHP function that compares time period one and time period two to see if there is an intersection, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.