On 9/8/06, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
On Fri, 2006-09-08 at 15:30 -0600, Jeremy Privett wrote: > Well, it could be this, too: > > switch( $_REQUEST['id'] ) { > case "white": > echo "Right color."; > break; > > case "black": > echo "Right color."; > break; > > default: > echo "Wrong color."; > break; > } Ugh, if you're going to use a big ugly case statement for something so trivial at least make use of the fall-through feature: <?php switch( $_REQUEST['id'] ) { case 'white': case 'black': { echo 'Right color.'; break; }
I don't know about big and ugly, it seems more clear on what is going on in this situation. But yeah it is best to clearify the switch as you rewrote it. curt. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php