adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code?
<?php
    $name = "What is your name?"
    if (preg_match("/name/"),$name)
    echo "My name is Will Pitt ";
    else
    echo "My name is not Will Pitt ";
    if (preg_match("/are/"))
    echo "I am great"
    else
    echo "I am not great";    
    ?>

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

d.

My name is not Will Pitt I am not great

Posted under PHP

Answer: (c).My name is Will Pitt I am not great

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 function is used to do a find and replace on a string or an array?

Q. Which one of the following preg PHP functions is used to take a string, and put it in an array?

Q. Which one of the following is not a preg PHP function?

Q. Parameter flags was added in which version of PHP?

Q. Which one of the following databases has PHP supported almost since the beginning?

Q. The updated MySQL extension released with PHP 5 is typically referred to as..

Q. Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?

Q. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?

Q. Which one of the following statements is used to create a table?

Q. Which one of the following statements instantiates the mysqli class?

Q. hich one of the following statements can be used to select the database?

Q. Which one of the following methods can be used to diagnose and display information about a MySQL connection error?

Q. Which method returns the error code generated from the execution of the last MySQL function?

Q. If there is no error, then what will the error() method return?

Q. Which one of the following is not a valid class name?

Q. Fill in the blank with the best option. An Object is a/an ________ of a class.

Q. There are two objects-
$product1 = new Shop();
$product2 = new Shop();
Which one of the following statements is right about them?

Q. Which version of PHP introduced the visibility keywords i.e public, private, and protected?

Q. Which characters is used to access property variables on an object-by-object basis?

Q. Code that uses a class, function, or method is often described as the..