$age = 25; // Value to be checked $min = 18; // Minimum value $max = 60; // Maximum value if(!t3lib_div::intInRange($age, $min, $max)) { echo "Age should be between 18 and 60"; }
$numbers = array(5, 14, 2, 7, 11, 8); $min = 1; $max = 10; $filtered = array_filter($numbers, function($value) use ($min, $max) { return t3lib_div::intInRange($value, $min, $max); }); print_r($filtered);In this example, intInRange() function is used as a callback function to filter out the values that are not in the specified range using array_filter() function. The output will be an array with the values 5, 2, 7, and 8. The package library for t3lib_div is TYPO3 CMS.