Skip to content

Instantly share code, notes, and snippets.

@tonylegrone
Last active September 23, 2015 21:47
Show Gist options
  • Save tonylegrone/621037 to your computer and use it in GitHub Desktop.
Save tonylegrone/621037 to your computer and use it in GitHub Desktop.
Detects if an integer is between the provided range.
<?php
/**
* Detects if an integer is between the provided range.
*
* @param int $int
* The integer to test against.
* @param int $min
* The minimum number $int can be.
* @param int $max
* The maximum number $int can be.
*
* @return bool
* TRUE if $int is within the range of $min and $max; FALSE if it is not.
*/
function between($int, $min, $max) {
return ($int >= $min && $int <= $max);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment