Examveda
Examveda

What will be the output of the following PHP code ?
<?php
for ($i = 0; $i % ++$i; $i++) 
{
    print"i";
}
?>

A. error

B. infinite loop

C. no output

D. 0

Answer: Option B

Solution(By Examveda Team)

Loop condition is true as i%(i+1) is a float non zero value in php.

This Question Belongs to PHP >> Control Structures(Loop In PHP)

Join The Discussion

Related Questions on Control Structures(Loop in PHP)