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

Home » PHP » PHP If Else/Else If Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $n = 5;
    if ($n++)
    print "Hello Interview Mania";
    else
    print "Hey Interview Mania";
    ?>
    1. Hello Interview Mania
    2. Hey Interview Mania
    3. Error
    4. Nothing
    5. None of these
Correct Option: A

n is incremented after if which evaluates to false.



Your comments will be displayed only after manual approval.