What will be the output of the following PHP code ?
<?php
$a = 5; $b = -7; $c =0;
$d = ++$a && ++$b || ++$c;
print $d; print $a;
?>
<?php
$a = 5; $b = -7; $c =0;
$d = ++$a && ++$b || ++$c;
print $d; print $a;
?>
A. 16
B. 06
C. 15
D. 05
Answer: Option A
Solution(By Examveda Team)
1&&0||1 is evaluated to 1 and the a is also preincremented to 6.Related Questions on Operators and Expressions in php
What will be the output of the following PHP code ?
<?php
"Hello World"
?>
A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
What will be the output of the following PHP code ?
<?php
print_r "Hello world"
?>
A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
A. redredred
B. redred
C. red
D. Error
A. # Hello world
B. Hello world# Hello world
C. Hello world
D. Error
Join The Discussion