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, and may result in gaps if the array was indexed. The result array can be reindexed using the array_values function.
The array to iterate over
The callback function to use
If no callback is supplied, all empty entries of array will be removed. See empty for how PHP defines empty in this case.
Flag determining what arguments are sent to callback:
ARRAY_FILTER_USE_KEY - pass key as the only argument to callback instead of the value
ARRAY_FILTER_USE_BOTH - pass both value and key as arguments to callback instead of the value
Returns the filtered array.
If the array is changed from the callback function (e.g. element added, deleted or unset) the behavior of this function is undefined.
|8.0.0||callback is nullable now.|
|8.0.0||If callback expects a parameter to be passed by reference, this function will now emit an E_WARNING.|