A

Admin • 828.03K Points
Coach

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

Code:
<?php
$k = 1;
switch(print $k)
{
case 2:
print "Statement1";
break;
case 1:
print "Statement2";
break;
default:
print "Statement3";
}
?>
  • (A) Error
  • (B) Statement1
  • (C) Statement3
  • (D) 1Statement2
  • Correct Answer - Option(D)
  • Views: 5
  • Filed under category PHP
  • Hashtags:

Explanation by: Admin
Print returns 1,thus it gives case 1.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.