Vidyalelo
PHP · Q26

Regular Expressions

Programming · PHP · question 26

Q26

What will be the output of the following PHP code?

A.
Hello! My name was Cameron Fox. tea?
B.
Hello! My name is Cameron Fox. tea?
C.
Hello! My name is Cameron Fox. Coffee?
D.
Hello! My name was Cameron Fox. Coffee?
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
Coffee was not replaced because the preg_replace function is case sensitive. Therefore it treats coffee and Coffee differently.