I got this code…it’s used two loops for.., can u explain how it’s work ? the result is 16
for($i=1; $i<=2; $i++)
{
for($j=1; $i<=5; $i++)
{
if($i == 1)
echo $j;
elseif($i ==2)
echo $j+5;
}
}
but if I make like this
for($i=1; $i<=2; $i++)
{
for($j=1; $i<=5; $i++)
{
if($i == 1)
echo $j;
elseif($i ==2)
echo $j;
}
}
the result is 11.
how can be ?
Your code is same as:
So:
The first piece of code echo
1and1+5, which will be16.The second piece of code echo
1and1, which will be11.