Re: Control Structure problem

From: Date: Wed, 17 Sep 2003 07:45:38 +0000
Subject: Re: Control Structure problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-162835@lists.php.net to get a copy of this message
In article <067b01c37cb5$c9955e00$0201a8c0@audioslave>, masterskywalker@tpg.com.au says... > yeah, i really like using cases they work well and especially if you want to > do something different for different values, i forgot about that, its a good > way to do it, > > does php have case else? cuz that is a really handy thing in VB that people > often forget... You mean 'default' switch ($var) { case 'TEST-1': case 'TEST-2': case 'TEST-2': do_something(); break; // to stop falling through to next option default: // any other case not above do_other_thing(); break; //Not really needed as is last statement but good practice } And default can appear anywhere in the statement, not just as last item. Cheers -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet?

« previous php.general (#162835) next »