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

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

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



Your comments will be displayed only after manual approval.