A

Admin • 828.03K Points
Coach

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

Code:
<?php
$p = 0;
while ($p++)
{
print $p;
}
print $p;
?>
  • (A) Error
  • (B) 0
  • (C) 1
  • (D) Nothing
  • Correct Answer - Option(C)
  • Views: 10
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin
As it is a post increment, it checks and then does not enter the loop, thus prints only 1.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.