πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$n = 1;
while(++$n || --$n)
{   
    print $n;
}
?>
  • (A) 2345678......infinite time
  • (B) 12345678...........infinite time
  • (C) Error
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (A) 2345678......infinite time

Explanation: As it is || operator the second expression is not evaluated and n is always incremented, in the first case to 1.

Explanation by: Jitendra Singh
As it is || operator the second expression is not evaluated and n is always incremented, in the first case to 1.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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