Vidyalelo
PHP · Q24

Regular Expressions

Programming · PHP · question 24

Q24

What will be the output of the following PHP code?

A.
My name is Will Pitt I am great
B.
My name is not Will Pitt I am great
C.
My name is Will Pitt I am not great
Answer
D.
My name is not Will Pitt I am not great

Answer: Option C

Solution

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