filter()
The filter() method creates a new array with all elements that pass the function.
Example.php
Syntax
Parameter
$callback
A function to test each element of the array. Return a value that coerces to
TRUE
to keep the element, or toFALSE
otherwise. Function taking three arguments:$value
The current element being processed in the array.$key
The index of the current element being processed in the array.$array
The arrayevery
was called upon.
Return value
A filtered array.
Prefixing
References
Last updated