Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

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

    <?php

    $i = 0;

    while ((--$i > ++$i) - 1)

    {

    print $i;

    }

    ?>

  2. A.

     00000000000000000000….infinitely

    B.

     -1-1-1-1-1-1-1-1-1-1…infinitely

    C.

     no output

    D.

     error

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    (–$i > ++$i) evaluates to 0 but -1 makes it enters the loop and prints i which is 0.


Be The First To Comment