"> What will be the output of the following PHP code ?<?phpfor

Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    for ($g = 0; $g % ++$g; $g++)
    {
    print"g";
    }
    ?>
    1. 0
    2. Error
    3. Nothing
    4. g
    5. None of these
Correct Option: C

Loop condition is true as g%(g+1) is a float non zero value in php.



Your comments will be displayed only after manual approval.