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

Home » PHP » PHP If Else/Else If Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $num = 1;
    if ($num--)
    print "First"
    $num--;
    else
    print "Second"
    ?>
    1. Nothing
    2. Error
    3. First
    4. Second
    5. None of these
Correct Option: B

The if statement has no brackets and it expects a else/else if after a if.



Your comments will be displayed only after manual approval.