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

Home » PHP » PHP While Loops » Question
  1. What will be the output of the following PHP code ?
    <?php
    $num = 2;
    while ($num != 5)
    {
    print "Executed...";
    $num++;
    }
    ?>
    1. Executed...
    2. Executed...Executed...
    3. Executed...Executed...Executed...
    4. Executed...Executed...Executed...Executed...Executed...
    5. None of these
Correct Option: C

The check happens before the increment, thus it prints until i = 5.



Your comments will be displayed only after manual approval.