Its syntax is: array preg_grep (string pattern, array input_array) <? $foods = array("pasta", "steak", "fish", "potatoes"); $p_foods = preg_grep("/p(\w+)/", $foods); $x = 0; while ($x < sizeof($p_foods)) : print $p_foods[$x]. "<br>"; $x++; endwhile; ?>