Check if a variable is an integer within a specific range using filter_var() with FILTER_VALIDATE_INT and a range option.
Source Code
$options = [
"options" => [
"min_range" => 1,
"max_range" => 100
]
];
$var = 50;
if (filter_var($var, FILTER_VALIDATE_INT, $options) !== false) {
echo "The variable is within the range.";
}