You are here: Re: switch easy « All PHP « IT news, forums, messages
Re: switch easy

Posted by Janwillem Borleffs on 06/25/07 11:36

Michael Fesser schreef:
> In a situation like this a switch is the perfect solution:
>
> switch ($foo) {
> case 1: doThis(); break;
> case 2: doThat(); break;
> case 3: doSomething(); break;
> case 4: doSomethingElse(); break;
> default: doWhatever();
> }
>
> The alternative would be a cascade of 4 if-else statements ... Ugly.
>

Like Geoff, I also favor the use of arrays. I wrote the following
document some time ago on the subject:

http://docs.jwscripts.com/PHP%20spaghetti.doc


JW

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация