User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 392,000 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,183 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

If Or Switch

Join Date: Aug 2005
Location: somewhere in time
Posts: 71
Reputation: TopDogger is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: If Or Switch

  #2  
May 16th, 2006
IMHO, "Switch" is better if you have to qualify a variable with a lot of different possible values and each requires a different process.

"If" is better if you only have to test for a few possible values. A long list of If-ElseIf statements gets to be pretty hard to read sometimes.

I generally use "Switch" if I need to test for three or more possible values.
Reply With Quote  
All times are GMT -4. The time now is 10:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC