?
What will be the output of the following PHP code ?
What will be the output of the following PHP code ?
<?php
for ($i = 0;$i = -1;$i = 1)
{
print $i;
if ($i != 1)
break;
}
?>
<?php
for ($i = 0;$i = -1;$i = 1)
{
print $i;
if ($i != 1)
break;
}
?>
Answer & Solution
Correct Answer:
Option
C
The order of execution is initialization, check, increment/decrement, check, increment/decrement, check, increment/decrement….so on .
Join the Discussion
Login to post a comment or share your explanation.
Login