Answers for "filter array in php with passing extra params"

PHP
0

filter array in php with passing extra params

$a = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
$p = 5;
 
$r = array_filter($a, function($i) use ($p) { return $i < $p; });
print_r($r);
Posted by: Guest on March-02-2021

Code answers related to "filter array in php with passing extra params"

Browse Popular Code Answers by Language