Skip to content

Instantly share code, notes, and snippets.

@jordanbrauer
Created September 16, 2019 21:22
Show Gist options
  • Save jordanbrauer/2b60c896e344a78ae2112c255de5caac to your computer and use it in GitHub Desktop.
Save jordanbrauer/2b60c896e344a78ae2112c255de5caac to your computer and use it in GitHub Desktop.
determine if a value is within range
/**
* Determine if a numeric value is within range
*
* @return bool
*/
function between($subject, $min, $max): bool {
if (!is_numeric($subject) {
throw new LogicException;
}
return $subject >= $min and $subject <= $max;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment