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

The order of execution is initialization, check, increment/decrement, check, increment/decrement, check, increment/decrement….so on .



Your comments will be displayed only after manual approval.