What will be the output of the following PHP code?

🎲 Try a Random Question  |  Total Questions in Quiz: 10  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
PHP Programming Basics Practice Test: Basics of Preg in PHP — practice the complete quiz, review flashcards, or try a random question.

The preg_match() function is a built-in function of PHP that performs a regular expression match. This function searches the string for pattern, and returns true if the pattern exists otherwise returns false. Generally, the searching starts from the beginning of $subject string parameter.

Related Test: PHP Programming Basics Practice Test: Strings And Regular Expression in PHP


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