My Report

PHP Function Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What will be the output of the following PHP code?

<?php
    $str = "Hello World"
    echo wordwrap($str,5,"<br>\n");    
?>

2. What will be the output of the following PHP code?

<?php
    $title = "O'malley wins the heavyweight championship!";
    echo ucwords($title);
?>

3. What will be the output of the following PHP code?

    
<?php
    echo strtr("Hilla Warld","ia","eo");
?>

4. What will be the output of the following PHP code?

    
<?php
    $str = "Hello world. It's a beautiful day.";
    print_r (explode(" ",$str));
?>

5. What will be the output of the following PHP code?

<?php
    echo lcfirst("welcome to India");
?>

6. What will be the output of the following PHP code?

<?php
    echo str_pad("Salad", 5)." is good.";
?>

7. What will be the output of the following PHP code?

<?php
    echo ucwords("i love my country");
?>

8. What will be the output of the following PHP code?

    
<?php
    echo hex2bin("48656c6c6f20576f726c6421");
?>

9. What will be the output of the following PHP code?

    
<?php 
    $str = addslashes('What does "yolo" mean?');
    echo($str); 
?>

10. What will be the output of the following PHP code?

    
<?php
    echo stripos("I love php, I love php too!","PHP");
?>

 

Start practicing “1000 MCQs on PHP”, and once you are ready, you can take tests on all topics by attempting our “PHP Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.