PHP Preg_Grep – String Function

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

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.