What will be the output of the following PHP code (20)?

87. What will be the output of the following PHP code?

<?php
$a = 15;
$b = 20;

if ($a < ++$a || $b < ++$b){
    echo "True";
}
else{
    echo "False";
}
?>
  1. True
  2. False
  3. TrueFalse
  4. Parse Error

Answer: B) False

Explanation:

In PHP, the precedence of ++ operator is higher than < operator, so the first increment operation executes, and then the comparison operation will execute. But when the comparison operation executes, both OR operator conditions will return false. Thus, the else block will be executed.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.