Switch Case : Doubts
<?php
$favcolor="red";
switch ($favcolor)
{
default:
echo "Your favorite color is neither red, blue, or green!";
case "red":
echo "Your favorite color is red!";
case "blue":
echo "Your favorite color is blue!";
break;
case "green":
echo "Your favorite color is green!";
break;
?>
Output::
Your favorite color is red!Your favorite color is blue!
2)When I shifted default after case "red" and omitted break from case "red" it was executing default too!(Why?),but when I shifted default at the top of the block it was not executing.