Home / CSE / PHP - CS :: Operators and Expressions in php

CSE :: PHP - CS

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

    <?php

    $a = 10;

    $b = 4;

    $c = fun(10,4);

    function fun($a,$b)

    {

    $b = 3;

    return $a - $b + $b - $a;

    }

    echo $a;

    echo $b;

    echo $c;

    ?>

  2. A.

     104

    B.

     410

    C.

     1400

    D.

     4100

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $a = "$winner";

    $b = "/$looser";

    echo $a,$b;

    ?>

  4. A.

     $winner/$looser

    B.

     /$looser

    C.

     /

    D.

     $looser

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $a = "$winner";

    $b = "$looser";

    echo $a, $b;

    ?>

  6. A.

     $winner$looser

    B.

     $looser

    C.

     \

    D.

     $looser

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $a = "$winner";

    $b = "$looser";

    echo $a, $b;

    ?>

  8. A.

     $winner$looser

    B.

     $looser

    C.

     \

    D.

     $looser

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $x = 5;

    $y = 10;

    function fun()

    {

    $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y'];

    }

    fun();

    echo $y;

    ?>

  10. A.

     5

    B.

     10

    C.

     15

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $x = 5;

    $y = 10;

    function fun()

    {

    $y = $GLOBALS['x'] + $GLOBALS['y'];

    }

    fun();

    echo $y;

    ?>

  12. A.

     5

    B.

     10

    C.

     15

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    function fun()

    {

    $x = 0;

    echo $x;

    $x++;

    }

    fun();

    fun();

    fun();

    ?>

  14. A.

     012

    B.

     123

    C.

     000

    D.

     111

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    function fun()

    {

    static $x = 0;

    echo $x;

    $x++;

    }

    fun();

    fun();

    fun();

    ?>

  16. A.

     012

    B.

     123

    C.

     111

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    static $x = 0;

    function fun()

    {

    echo $x;

    $x++;

    }

    fun();

    fun();

    fun();

    ?>

  18. A.

     012

    B.

     123

    C.

     Nothing

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum


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

    <?php

    $x=0;

    function fun()

    {

    echo $GLOBALS['x'];

    $GLOBALS['x']++;

    }

    fun();

    fun();

    fun();

    ?>

  20. A.

     000

    B.

     012

    C.

     123

    D.

     Error

    View Answer

    Workspace

    Discuss Discuss in Forum