Omitting the break statement can be useful in some cases : Switch : Language Basics PHP Source Code


PHP Source Code » Language Basics » Switch »

 

Omitting the break statement can be useful in some cases




<?
    $aColor = "Red";
    switch$aColor )
    {
        case "red":
        case "Red":
            // The following prints if $aColor is
            // either "red" or "Red"
            print"#FF0000<br>" );
            break;
        case "green":
        case "Green":
            print"#00FF00<br>" );
            break;
        case "blue":
        case "Blue":
            print"#0000FF<br>" );
            break;
        default:
            print"other<br>" );
            break;
    }
?>
           
       



HTML code for linking to this page:

    PHP Function Reference -> Users Code Examples / Notes - > Switch:
  • switch
Follow Navioo On Twitter

PHP Source Code

 Navioo Language Basics
» Switch