Home » PHP » PHP Strings » Question
  1. What will be the output of the following PHP code?
    $cars = array("Datsun", "Jeep", "Lada", "Spyker");
    $car = preg_grep("/^L/", $cars);
    print_r($car);
    ?>
    1. Array
      (
      [2] => Lada
      )
    2. Array
      (
      [1] => Jeep
      )
    3. Array
      (
      [0] => Datsun
      )
    4. Array
      (
      [3] => Spyker
      )
    5. None of these
Correct Option: A

This function is used to search an array for foods beginning with s.



Your comments will be displayed only after manual approval.