Last active
June 9, 2020 03:20
-
-
Save raulinoneto/c7764aa87b058492efe3981ae70703d2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
/** | |
* @var $initial int | |
* @var $end int | |
* @var $startEvent int | |
* @var $endEvent int | |
*/ | |
function eventIsBetween($inital, $end, $startEvent, $endEvent):bool{ | |
if ($startEvent > $end || $endEvent < $initial){ | |
return false | |
} | |
for($i=$initial;$i>=$end; $i++){ | |
if(isBetween($i, $initial, $end)){ | |
return true; | |
} | |
} | |
return false; | |
} | |
/** | |
* @var $needle int | |
* @var $initial int | |
* @var $end int | |
*/ | |
function isBetween($needle, $initial, $end):bool | |
{ | |
return ($needle <= $end) && ($needle >= $initial); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment