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

What will be the output of the following PHP code?
<?php
$str = "Hello! My name is Cameron Fox. Coffee?"
$find = array('/is/','/coffee/');
$replace = array('/was/','/tea/');
echo preg_replace ($find, $replace, $str);
?>

Answer & Solution
Correct Answer: Option D
Coffee was not replaced because the preg_replace function is case sensitive. Therefore it treats coffee and Coffee differently.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.