Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    $x = 75;

    $y = 25;

    function addition()

    {

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

    }

    addition();

    echo $z;

    ?>

  2. A.

     100

    B.

     error

    C.

     75

    D.

     25

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    z is a variable present within the $GLOBALS array, it is also accessible from outside the function!


Be The First To Comment