Home  >  Article  >  Backend Development  >  PHP function to compare whether time period one and time period two intersect_PHP tutorial

PHP function to compare whether time period one and time period two intersect_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:29:23741browse

Copy code The code is as follows:

/*
*Compare time period one and time period two to see if there is any 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;
}
}
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323439.htmlTechArticleCopy the code The code is as follows: /* *Compare time period one and time period two to see if there is any intersection*/ function isMixTime( $begintime1,$endtime1,$begintime2,$endtime2) { $status = $begintime2 - $begint...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn