Home » PHP » PHP For Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    for ($n = -5; $n < 10; --$n)
    {
    print $n;
    }
    ?>
    1. Error
    2. Nothing
    3. -5-6-7-8-9........infinite time
    4. -1-2-3-4-5-6-7
    5. None of these
Correct Option: C

The value of n is decremented thus making it an infinite loop.



Your comments will be displayed only after manual approval.