What will be the output of the following PHP code ?
<?php
for ($i++; $i == 1; $i = 2)
print "In for loop ";
print "After loopn";
?>
<?php
for ($i++; $i == 1; $i = 2)
print "In for loop ";
print "After loopn";
?>
A. In for loop
B. After for loop
C. In for loopAfter for loop
D. Infinite loop
Answer: Option C
Solution(By Examveda Team)
The loop runs only once as value of x is incremented.Related Questions on Control Structures(Loop in PHP)
A. how are u
B. hi
C. error
D. no output
A. hi
B. no output
C. error
D. how are u
A. how are uhello
B. hihello
C. hi
D. no output
A. true
B. false
C. error
D. no output
Join The Discussion