Vidyalelo
PHP · Q57

Control Structures(Loop In PHP)

Programming · PHP · question 57

Q57

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.