PHP Functions


  1. What will be the output of the following PHP code?
    <?php
    echo stripos("I know the php, I love to know the php too!","know");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The stripos() function finds the position of the first occurrence of a string inside another string.


  1. What will be the output of the following PHP code?
    <?php
    $title = "interview mania founded by manjesh ojha";
    echo ucwords($title);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The ucwords() function capitalizes the first letter of each word in a string. Its prototype follows: string ucwords(string str).



  1. What will be the output of the following PHP code?
    <?php
    echo str_pad("This", 10)." theory is good.";
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The str_pad() function pads a string with a specified number of characters.


  1. What will be the output of the following PHP code?
    <?php
    $string = "Interview Mania";
    echo wordwrap($string, 9, "\n");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The wordwrap() function wraps a string into new lines when it reaches a specific length.



  1. What will be the output of the following PHP code?
    <?php
    echo ucwords("this is an important.");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    The ucwords() function converts the first character of each word in a string to uppercase.