Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    function fun()

    {

    $x = 0;

    echo $x;

    $x++;

    }

    fun();

    fun();

    fun();

    ?>

  2. A.

     012

    B.

     123

    C.

     000

    D.

     111

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    Every time the function is called the value of x becomes 0, therefore we get 0 on every function call.


Be The First To Comment