<?php $foods = array("pasta", "steak", "fish", "potatoes"); $food = preg_grep("/^p/", $foods); print_r($food); ?>