Switch question - Page 2

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Re: Switch question

Am 12.01.2014 17:48, schrieb richard:

Quoted text here. Click to load it

1) Go to <http://php.net/manual/en

2) Use the "Search" box to look for "switch"

3) You should find this:



The statement list for a case can also be empty, which simply passes
control into the statement list for the next case.

switch ($i) {
case 0:
case 1:
case 2:
    echo "i is less than 3 but not negative";
case 3:
    echo "i is 3";

Quoted text here. Click to load it

case 1:
case 2:
case 3:
    // dosomething
    break;   // <--- THIS IS IMPORTANT!

case A:
case B:
case C:
    // dosomethingelse
    break;   // <!-- THIS IS IMPORTANT!

    // if nothing else matches

Arno Welzel

Site Timeline