Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    for ($v = 0; $v < 5; $v++)
    {
    for ($u = $v; $u > 0; $v--)
    print $v;
    }
    ?>
    1. Error
    2. 0-1-2-3-4
    3. 0-1-2-2-3-3-4-3-4
    4. Infinite loop
    5. None of these
Correct Option: D

In the second loop u value is not being changed.



Your comments will be displayed only after manual approval.