Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    $s = 2;
    for (1; $s == 1; $s = 2)
    {
    print "In for loop executed...";
    }
    print "After for loop statement executed...\n";
    ?>
    1. Nothing
    2. In for loop executed...
    3. After for loop statement executed...
    4. Error
    5. None of these
Correct Option: C

The loop does not run as s initialized in check statement will be zero.



Your comments will be displayed only after manual approval.