πŸ“Š PHP
Q. What will be the output of the following PHP code ?
Code:
<?php
$opt = "1";
switch($opt)
{
case 1:
    break;
    print "First Statement";
case 2:
    print "Second Statement";
    break;
default:
    print "Third Statement";
}
?>
  • (A) First Statement
  • (B) Second Statement
  • (C) Third Statement
  • (D) Nothing
πŸ’¬ Discuss
βœ… Correct Answer: (D) Nothing

Explanation: As break is provided before print statement in case 1 it breaks the loop before printing.

Explanation by: Parvesh Kanani
As break is provided before print statement in case 1 it breaks the loop before printing.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
224
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Parvesh Kanani
Publisher
πŸ“ˆ
84%
Success Rate