Menu Riverview Church

PREG_GREP

Return array entries that match the pattern

SYNTAX

preg_grep ( string $pattern , array $input [, int $flags = 0 ] ) : array

PARAMETERS

pattern

The pattern to search for, as a string.

input

The input array.

flags

If set to PREG_GREP_INVERT, this function returns the elements of the input array that do not match the given pattern.

RETURN

Returns an array indexed using the keys from the input array.

EXAMPLES

PATTERN INPUT

Array
(
    [2] => 2.2
    [3] => 3.3
)

FLAGS

Array
(
    [0] => 0
    [1] => 1
)

PHP