Re: IF or SWITCH

From: Date: Thu, 06 Apr 2006 16:56:01 +0000
Subject: Re: IF or SWITCH
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-233385@lists.php.net to get a copy of this message
On Thu, 2006-04-06 at 09:08, John Wells wrote: > > ...Either way, > > internally, switch behaves like if/elseif/else and generally only > > provides an advantage with respect to code organization or if you want a > > particular condition to drop through to other case blocks. > > > > Considering this is regarding an if/else with ***57*** conditional > checks, wouldn't we be wise in suggesting switch/case if one of its > benefits is code organization and readability? No! Due to the complexity of the conditionals in question nothing but an extra indentation level would be gained by using switch semantics. > Imagine having to come back to this code block in a months time to trace a bug. > > *shudder* Comments are a tool, and should be used as such. Syntax highlighting can make the experience much easier to swallow since your comments should stand out if written clearly and concisely. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#233385) next »