Question
<?php
$str = "Hello! My name is Cameron Fox. Coffee?"
$find = array('/is/','/coffee/');
$replace = array('/was/','/tea/');
echo preg_replace ($find, $replace, $str);
?>
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?
Posted under PHP
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What will be the output of the following PHP code?
Similar Questions
Discover Related MCQs
Q. Which one of the following preg PHP functions is used to take a string, and put it in an array?
View solution
Q. Which one of the following is not a preg PHP function?
View solution
Q. Parameter flags was added in which version of PHP?
View solution
Q. Which one of the following databases has PHP supported almost since the beginning?
View solution
Q. The updated MySQL extension released with PHP 5 is typically referred to as..
View solution
Q. Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
View solution
Q. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
View solution
Q. Which one of the following statements is used to create a table?
View solution
Q. Which one of the following statements instantiates the mysqli class?
View solution
Q. hich one of the following statements can be used to select the database?
View solution
Q. Which one of the following methods can be used to diagnose and display information about a MySQL connection error?
View solution
Q. Which method returns the error code generated from the execution of the last MySQL function?
View solution
Q. If there is no error, then what will the error() method return?
View solution
Q. Which one of the following is not a valid class name?
View solution
Q. Fill in the blank with the best option. An Object is a/an ________ of a class.
View solution
Q. There are two objects-
$product1 = new Shop();
$product2 = new Shop();
Which one of the following statements is right about them?
View solution
Q. Which version of PHP introduced the visibility keywords i.e public, private, and protected?
View solution
Q. Which characters is used to access property variables on an object-by-object basis?
View solution
Q. Code that uses a class, function, or method is often described as the..
View solution
Q. Which keyword precedes a method name?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond PHP? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!