New in version 3.2.
Selects a subset of an array to return based on the specified condition. Returns an array with only those elements that match the condition. The returned elements are in the original order.
$filterhas the following syntax:
An expression that resolves to an array.
Optional. A name for the variable that represents each individual element of the
inputarray. If no name is specified, the variable name defaults to
An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the
inputarray individually with the variable name specified in
For more information on expressions, see Expressions.