How do I search in an array with preg_match?
Example:
name\
$haystack = array ( 'say hello', 'hello stackoverflow', 'hello world', 'foo bar bas' ); $matches = preg_grep('/hello/i', $haystack); print_r($matches);
Output
Array ( [1] => say hello [2] => hello stackoverflow [3] => hello world )