Examveda
Examveda

What will be the output of the following PHP code ?
<?php
$a = 10;
$b = 11;
if ($a < ++$a || $b < ++$b)
    print "hello";
else
    print "hi";
?>

A. hi

B. hello

C. error

D. no output

Answer: Option A

Solution(By Examveda Team)

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

This Question Belongs to PHP >> Control Structures(Loop In PHP)

Join The Discussion

Related Questions on Control Structures(Loop in PHP)