"> 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 ($c = 4; $c < 9; $c++)
    {
    for(; $c < 9; $c++)
    print"c";
    }
    ?>
    1. c
    2. cc
    3. ccc
    4. cccc
    5. ccccc
Correct Option: E

The c value is changed in the inner loop and reaches five, thus does not execute the second outer loop.



Your comments will be displayed only after manual approval.