Home  >  Article  >  Backend Development  >  比较时间段一与时间段二是否有交集的php函数_PHP

比较时间段一与时间段二是否有交集的php函数_PHP

WBOY
WBOYOriginal
2016-06-01 12:16:56814browse
复制代码 代码如下:
/*
*比较时间段一与时间段二是否有交集
*/
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;
}
}
}
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