Examveda
Examveda

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: Option C

Solution(By Examveda Team)

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

This Question Belongs to PHP >> Basic PHP

Join The Discussion

Comments ( 1 )

  1. Rakesh
    Rakesh :
    4 years ago

    In this question, you didn't mention default after end of case. so, whenever we try to execute this code we got first option which is correct but here displayed option C is correct .. so please correct this question. mention default otherwise set correct question.

Related Questions on Basic PHP