Examveda
Examveda

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;
?>

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.

This Question Belongs to PHP >> Operators And Expressions In Php

Join The Discussion

Related Questions on Operators and Expressions in php