ExamVeda
Login
Home
This question belongs to PHP Regular Expressions
Regular Expressions
?

What will be the output of the following PHP code?
<?php
$foods = array("pasta", "steak", "fish", "potatoes");
$food = preg_grep("/^s/", $foods);
print_r($food);
?>

Answer & Solution
Correct Answer: Option C
This function is used to search an array for foods beginning with s.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.