Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. 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;

    ?>

  2. A.

     5

    B.

     10

    C.

     15

    D.

     Error

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The value of global variable y does not change therefore it’ll print 10;


Be The First To Comment