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

Home » PHP » PHP Operators » Question
  1. What will be the output of the following PHP code ?
    <?php
    $p = 20;
    $q = 10;
    if ($p || ($q = $p + 10)) {
    echo "True";
    }
    echo $q;
    ?>
    1. 10
    2. 20
    3. True
    4. 10True
    5. True10
Correct Option: E

In if condition when the first case is 1 and is an || operation then the second command is not executed.



Your comments will be displayed only after manual approval.