Created
May 29, 2012 00:01
-
-
Save guiman/2821760 to your computer and use it in GitHub Desktop.
Time Range Overlap verification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
@param String $time1 , Time representation | |
@param String $time2 , Time representation | |
@return boolean , wheter time range 1 and time range 2 overlaps or not | |
*/ | |
public function overlaps($from1,$to1,$from2,$to2) | |
{ | |
$start1 = strtotime($from1); | |
$end1 = strtotime($to1); | |
$start2 = strtotime($from2); | |
$end2 = strtotime($to2); | |
return (($start1 < $end2) && ($start2 < $end1)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment