adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code?
<?php
    function convertSpace($string)
    {
        return str_replace("_", " ", $string);
    }
    $string = "Peter_is_a_great_guy!";
    echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
    ?>

a.

Peter_is_a_great_guy!

b.

Peterisagreatguy!

c.

Peter is a great guy!

d.

Error

Posted under PHP

Answer: (c).Peter is a great guy!

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 filter checks if variable of specified type exists?

Q. Which one of the following does not describe a validating filter?

Q. Which one of the following filter is used to filter several variables with the same or different filters?

Q. How many types of filtering are present in PHP?

Q. Which of the following is/are an external data?

i) Cookies
ii) Input data from a form
iii) Server Variables
iv) Web services data

Q. Which of the following is/are an exception?

i) OutOfBoundException
ii) OutOfRangeException
iii) OverflowException
iv) UnderflowException

Q. Which of the following is/are not an exception?

i) BadFunctionCallException
ii) BadMethodCallException
iii) LogicException
iv) DomainException

Q. How many predefined exceptions does SPL provide access to?

Q. What does SPL stand for?

Q. You can extend the exception base class, but you cannot override any of the preceding methods because the are declared as__________

Q. Which one of the following is the right description for the method getMessage() ?

Q. Which of the following statements invoke the exception class?

Q. Which version added the method getPrevious()?

Q. How many methods are available for the exception class?

Q. Which version of PHP was added with Exception handling?

Q. Which function is responsible for sending a custom message to the system log?

Q. Which logging option’s description is, if an error occurs when writing to the syslog, send output to the system console?

Q. Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions?

Q. Which of the following statements causes PHP to disregard repeated error messages that occur within the same file and on the same line?

Q. Which version introduced the function error_get_last()?