On 11-04-29 08:04 AM, Steve Staples wrote:
On Thu, 2011-04-28 at 19:19 -0400, Robert Cummings wrote:
On 11-04-28 06:37 PM, dholmes1031@xxxxxxxxx wrote:
Thanks switch and case seems to be more faster for the job and a lot cleaner
------Original Message------
From: Andre Polykanine
To: dholmes1031@xxxxxxxxx
Cc: php-general@xxxxxxxxxxxxx
Subject: Re: What's faster using if else or arrays?
Sent: Apr 28, 2011 6:17 PM
Hello Dholmes1031,
I would write it like this:
switch($foo) {
case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}
This sounds like a job for *dun dun dun* GOTO!
Kidding, of course ;)
Cheers,
Rob.
--
you should be removed and banned from this list for even just THINKING
about using a GOTO! :P
(yes, there are still *SOME* (and i use that loosely) benefits to the
GOTO command, but in reality, no.)
I've written parsers in the past that would have benefited greatly from
GOTO. So, in reality (for me anyways), yes. Also, tracking state
variables or using break with level parameter to escape from multi level
loops isn't any clearer than a goto, so sometimes its succinctness adds
clarity to the code making maintenance simpler. But obviously the above
was in jest :)
Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php