Vidyalelo
PHP · Q100

Operators And Expressions

Programming · PHP · question 100

Q100

What will be the output of the following PHP code ? ++ i) - 1) print i; ?>

A.
00000000000000000000….infinitely
Answer
B.
-1-1-1-1-1-1-1-1-1-1…infinitely
C.
no output
D.
error

Answer: Option A

Solution

Answer: Option A
Solution:
(–i) evaluates to 0 but -1 makes it enters the loop and prints i which is 0.