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

What will be the output of the following PHP code?
<?php
$name = "What is your name?"
if (preg_match("/name/"),$name)
  echo "My name is Will Pitt ";
else
  echo "My name is not Will Pitt ";
if (preg_match("/are/"))
  echo "I am great"
else
  echo "I am not great";    
?>

Answer & Solution
Correct Answer: Option C
The code uses preg_match to check for a keyword and replies based on whether it is true (1) or false (0).
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.