(PHP 4 >= 4.0.6)
array_filter -- Filters elements of an array using a callback functionarray_filter() returns an array containing all the elements of input filtered according a callback function. If the input is an associative array the keys are preserved.
Example 1. array_filter() example
The printout of the program above will be:
|
Note: Instead of a function name, an array containing an object reference and a method name can also be supplied.
See also array_map() and array_reduce().