Vidyalelo
PHP · Q90

Operators And Expressions

Programming · PHP · question 90

Q90

What will be the output of the following PHP code ? ( y != y++)) echo y; ?>

A.
1
B.
0
Answer
C.
2
D.
no output

Answer: Option B

Solution

Answer: Option B
Solution:
–$y == 2 is false but y is decremented, the xor gives true if only one of the operands are true, thus 1 xor 0 is true.