I can check if some integer value (which comes from user input, and thus should be filtered) is in specific range like this:
<?php
$size=50;
var_dump(in_array($size,range(1,100)));
?>
which will echo true if the size in range 1 to 100. Of course the other method is using filters:
<?php
$size=50;
$int_options = array("options"=>
array("min_range"=>0, "max_range"=>256));
var_dump(filter_var($size, FILTER_VALIDATE_INT, $int_options));
?>
But, what if I need to know if the elements of an array are in this range?(and probably remove those not) What is the best practice, considering the performance and memory usage. I prefer to use php functions instead of writing mine.
$sizecomes form user input. thanks