3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * Creates an anonymous filter function accepting items > $min * * Returns a single filter out of a family of "greater than n" filters */ function criteria_greater_than($min) { return function($itemio) use ($min) { var_dump($itemio); return $itemio > $min; }; } $input = array(1, 2, 3, 4, 5, 6); // Use array_filter on a input with a selected filter function $output = array_filter($input, criteria_greater_than(3)); print_r($output); // items > 3
Output for 7.3.0rc3
int(1) int(2) int(3) int(4) int(5) int(6) Array ( [3] => 4 [4] => 5 [5] => 6 )