"/>
Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    function fun($x,$y)

    {

    $x = 4;

    $y = 3;

    $z = $x + $y / $y + $x;

    echo "$z";

    }

    fun(3, 4);

    ?>

  2. A.

     7

    B.

     9

    C.

     0

    D.

     Error

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    Value 3, 4 is passed to the function but that is lost because x and y are initialised to 4 and 3 inside the function. Therefore we get the given result.


Be The First To Comment