"> 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 ($d = 0; -7 ; $d++)
    {
    print"d";
    if ($d == 4)
    break;
    }
    ?>
    1. d
    2. dd
    3. ddd
    4. dddd
    5. ddddd
Correct Option: E

The break statement after breaks the loop after d = 4,does not print anymore.



Your comments will be displayed only after manual approval.