array_filter

array_filter

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

array_filterFilters elements of an array using a callback function

Description

array array_filter ( array $array [, callable $callback [, int $flag = 0 ]] )

Iterates over each value in the array passing them to the callback function. If the callback function returns true, the current value from array is returned into the result array. Array keys are preserved.