"> What will be the output of the following PHP code ?<?php$p

Home » PHP » PHP While Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = 10;
    while (--$p > 0)
    {
    $p++;
    print $p;
    print "INDIA";
    }
    ?>
    1. Error
    2. 10
    3. 0
    4. 10INDIA......infinite time
    5. None of these
Correct Option: D

p is decremented in the first while execution and then continuously incremented back.



Your comments will be displayed only after manual approval.