Hi!

I make use of a switch statement, but now need to execute the same code of one case for a different case (it is a switch on a file type and some types are to be handled the same). I know how to craft this case using if, but how would I do that with using case within a switch?
Is it something like this
switch ($a) {
        case 'a' or 'b':
                // this is for the case that $a is 'a' or 'b'
        case 'c':
                // this is for the case that $a is 'c'
        default:
                // this is for the case that $a is neither 'a', 'b', or 'c'
}

For now I duplicate the code as that for sure works, but that seems to be not that great in case I need to change something within the block of code (have to do it in two places). The PHP manual doesn't cover this case.

Any tips are greatly appreciated.

        David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to