PHP Functions


  1. Which one of the following functions can be used to compress a string?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    We will be able to achieve almost 50% size reduction using this function. The gzuncompress() function is used to uncompress the string.


  1. What will be the output of the following PHP code?
    <?php
    echo chr(55);
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    The chr() function returns a character from the specified ASCII value. Since the ASCII value of 7 is 55, thus 7 was displayed.



  1. What will be the output of the following PHP code?
    <?php
    echo ord ("Ajit");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    The ord() function returns the ASCII value of the first character of a string. The ASCII value of A is 65, thus 65 was displayed.


  1. What will be the output of the following PHP code?
    <?php
    $string = "keep practicing at interviewmania";
    echo wordwrap($string, 15, "\n");
    ?>












  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    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("i love interview mania!");
    ?>











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

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