Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following PHP code?
<?php
$team = “arsenal”;
switch ($team) {
case “manu”:
echo “I love man u”;
case “arsenal”:
echo “I love arsenal”;
case “manc”:
echo “I love manc”; }
?>

What will be the output of the following PHP code?
<?php
$team = “arsenal”;
switch ($team) {
case “manu”:
echo “I love man u”;
case “arsenal”:
echo “I love arsenal”;
case “manc”:
echo “I love manc”; }
?>
a) I love arsenal
b) Error
c) I love arsenalI love manc
d) I love arsenalI love mancI love manu

Answer: c
Explanation: If a break statement isn’t present, all subsequent case blocks will execute until a break statement is located.

Join The Discussion