Home / CSE / PHP - CS :: Functions in PHP

CSE :: PHP - CS

  1. Which of the following PHP functions can be used for generating unique id’s?

  2. A.

     uniqueid()

    B.

     id()

    C.

     md5()

    D.

     mdid()


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

  4. A.

     zip_compress()

    B.

     zip()

    C.

     compress()

    D.

     gzcompress()


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

    <?php

    echo "chr(52)";

    ?>

  6. A.

     1

    B.

     2

    C.

     3

    D.

     4


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

    <?php

    echo ord ("hi");

    ?>

  8. A.

     106

    B.

     103

    C.

     104

    D.

     209


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

    <?php

    $str = "Hello World"

    echo wordwrap($str,5,"n");

    ?>

  10. A.

     Hello World

    B.

     Hello
    World

    C.

     Hell 0 Wo rld

    D.

     World


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

    <?php

    echo ucwords("i love my country");

    ?>

  12. A.

     I love my country

    B.

     i love my Country

    C.

     I love my Country

    D.

     I Love My Country


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

    <?php

    echo lcfirst("welcome to India");

    ?>

  14. A.

     welcome to India

    B.

     welcome to india

    C.

     Welcome to India

    D.

     Welcome to india


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

    <?php

    function calc($price, $tax="")

    {

    $total = $price + ($price * $tax);

    echo "$total";

    }

    calc(42);

    ?>

  16. A.

     Error

    B.

     0

    C.

     42

    D.

     84


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

    <?php

    function a()

    {

    function b()

    {

    echo 'I am b';

    }

    echo 'I am a';

    }

    a();

    a();

    ?>

  18. A.

     I am b

    B.

     I am bI am a

    C.

     Error

    D.

     I am a Error


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

    <?php

    function a()

    {

    function b()

    {

    echo 'I am b';

    }

    echo 'I am a';

    }

    b();

    a();

    ?>

  20. A.

     I am b

    B.

     I am bI am a

    C.

     Error

    D.

     I am a Error