Home » PHP » PHP Introduction » Question
  1. What will be the output of the following code?
    <?php
    function track()
    {
    static $var = 0;
    $var++;
    echo $var;
    }
    track();
    track();
    track();
    ?>
    1. 000
    2. 010
    3. 110
    4. 123
    5. None of these
Correct Option: D

Because $count is static, it retains its previous value each time the function is executed.



Your comments will be displayed only after manual approval.