Home / CSE MCQs / PHP MCQs :: Discussion

Discussion :: PHP MCQs

  1. What will be the output of the following code?
    < ?php  function track() { static $count = 0; $count++; echo $count ; } track(); track(); track(); ?>
  2. A.
    123
    B.
    111
    C.
    000
    D.
    011

    View Answer

    Workspace

    Answer : Option A

    Explanation :

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


Be The First To Comment