$array = array(1, 2, 3, 4); $result = Arrays::filter($array, function ($value) { return $value > 2; });
Array ( [2] => 3 [3] => 4 )
public static function filter(array $elements, $function) { return array_filter($elements, $function); }
private static function getClassMethods($class) { $methods = $class->getMethods(); return Arrays::filter($methods, function (ReflectionMethod $method) { return !$method->isConstructor() && !$method->isStatic(); }); }