HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
PHP Array Reference : Filter the values of an array using a callback function
The array_filter() function filters the values of an array using a callback function.
This function passes each value of the input array to the callback function. If the callback function returns true, the current value from input is returned into the result array. Array keys are preserved.
Parameter | Description |
---|---|
array | Required. Specifies the array to filter |
callbackfunction | Optional. Specifies the callback function to use |
flag | Optional. Specifies what arguments are sent to callback:
|
Return Value: | Returns the filtered array |
---|---|
PHP Version: | 4.0.6+ |
PHP Changelog: | PHP 5.6: Added optional flag parameter |
❮ PHP Array Reference