array preg_grep(string $pattern, array $source [, int $flags])
(PHP 4, PHP 5)
| $pattern | A POSIX regular expression string. |
|---|---|
| $source | An array of values to test against the regular expression. |
| $flags | The only option is PREG_GREP_INVERT which returns the opposite array (elements which DO NOT match the pattern). |
| RETURNS | An array made up of elements from the $source array which match the pattern ($pattern). |
Given an input array ($source) and regular expression ($pattern), this function will build a new array from the elements in $source that match the supplied pattern.