adplus-dvertising
frame-decoration

Question

What will be the output of the following PHP code ?
<?php
$i = "";
while ($i)
{   
    print "hi";
} 
while($i < 8)
    $i++;
print "hello";
?>

a.

Hi is printed 8 times, hello 7 times and then hi 2 times

b.

Hi is printed 10 times, hello 7 times

c.

Hi is printed once, hello 7 times

d.

Hi is printed once, hello 7 times and then hi 2 times

Posted under PHP

Answer: (d).Hi is printed once, hello 7 times and then hi 2 times

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What will be the output of the following PHP code ?