Use the 'default' case : Switch : Language Basics PHP Source Code


PHP Source Code » Language Basics » Switch »

 

Use the 'default' case




<?
    $nIndex = 17;
    switch $nIndex )
    {
        case 0:
            print"zero<br>" );
            break;
        case 1:
            print"one<br>" );
            break;
        case 2:
            print"two<br>" );
            break;
        default:
            print"neither zero, one nor two<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