?
What will be the output of the following PHP code?
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);
?>
<?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.
Join the Discussion
Login to post a comment or share your explanation.
Login