Q. What will be the output of the following PHP code ?
Code:
<?php
$num = 2;
while ($num < 5)
{
print "Hello";
$num--;
}
print "World";
?>
β
Correct Answer: (D)
Hello......infinite time
Explanation: Since the value of $num will always be less than 5 so while loop will never end.
It will print hello for infinite times .