?
What will be the output of the following PHP code?
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);
?>
<?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.
Join the Discussion
Login to post a comment or share your explanation.
Login