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

Discussion :: PHP - CS

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

    <?php

    $x = 4;

    $y = 3;

    function fun($x = 3, $y = 4)

    {

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

    echo "$z";

    }

    echo $x;

    echo $y;

    echo $z;

    fun($x, $y);

    ?>

  2. A.

     43

    B.

     943

    C.

     349

    D.

     439

    View Answer

    Workspace

    Answer : Option D

    Explanation :

    Firstly, the statements outside the function are printed, since z is not defined it’ll no value is printed for z. Next the function is called and the value of z inside the function is printed.


Be The First To Comment