Home » PHP » PHP If Else/Else If Statement » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = 25;
    $q = 26;
    if ($p < ++$p || $q < ++$q)
    print "if statement executed...";
    else
    print "else statement executed...";
    ?>
    1. else statement executed...
    2. Error
    3. if statement executed...
    4. Nothing
    5. None of these
Correct Option: A

The operator precedence of ++ is higher than <,thus the increment happens first and then compared.



Your comments will be displayed only after manual approval.