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

CSE :: PHP - CS

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

    <?php

    echo ucwords("i love my country");

    ?>

  2. A.

     I love my country

    B.

     i love my Country

    C.

     I love my Country

    D.

     I Love My Country

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    echo lcfirst("welcome to India");

    ?>

  4. A.

     welcome to India

    B.

     welcome to india

    C.

     Welcome to India

    D.

     Welcome to india

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

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

    {

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

    echo "$total";

    }

    calc(42);

    ?>

  6. A.

     Error

    B.

     0

    C.

     42

    D.

     84

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. 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();

    ?>

  8. A.

     I am b

    B.

     I am bI am a

    C.

     Error

    D.

     I am a Error

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. 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();

    ?>

  10. A.

     I am b

    B.

     I am bI am a

    C.

     Error

    D.

     I am a Error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $op2 = "blabla";

    function foo($op1)

    {

    echo $op1;

    echo $op2;

    }

    foo("hello");

    ?>

  12. A.

     helloblabla

    B.

     error

    C.

     hello

    D.

     helloblablablabla

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    function foo($msg)

    {

    echo "$msg";

    }

    $var1 = "foo";

    $var1("will this work");

    ?>

  14. A.

     error

    B.

     $msg

    C.

     0

    D.

     will this work

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    echo "chr(52)";

    ?>

  16. A.

     1

    B.

     2

    C.

     3

    D.

     4

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    echo ord ("hi");

    ?>

  18. A.

     106

    B.

     103

    C.

     104

    D.

     209

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    echo(atan(0.50));

    ?>

  20. A.

     0.11845976421345

    B.

     0.23568451142521

    C.

     0.46364760900081

    D.

     1

    View Answer

    Workspace

    Discuss Discuss in Forum