πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$num = 2;
while ($num < 5)
{
    print "Hello";
    $num--;
}
print "World";
?>
  • (A) Error
  • (B) World.......infinite time
  • (C) Nothing
  • (D) Hello......infinite time
πŸ’¬ Discuss
βœ… 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 .

Explanation by: Jitendra Singh
Since the value of $num will always be less than 5 so while loop will never end.
It will print hello for infinite times .

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
208
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Jitendra Singh
Publisher
πŸ“ˆ
84%
Success Rate