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

Code:
<?php
$m = 8;
while (--$m > 0 || ++$m)
{   
    print $m;
}
?>
  • (A) Error
  • (B) 76546211111........infinite time
  • (C) 8
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (B) 76546211111........infinite time
Explanation: As it is || operator the second expression is not evaluated till m becomes 1 then it goes into a loop.
Explanation by: Jitendra Singh
As it is || operator the second expression is not evaluated till m becomes 1 then it goes into a loop.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
186
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Jitendra Singh
Publisher
πŸ“ˆ
90%
Success Rate