Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    static $x = 0;

    function fun()

    {

    echo $x;

    $x++;

    }

    fun();

    fun();

    fun();

    ?>

  2. A.

     012

    B.

     123

    C.

     Nothing

    D.

     Error

    View Answer

    Workspace

    Answer : Option C

    Explanation :

    Since variable x is not defined inside the function fun(), nothing will be printed.


Be The First To Comment