You are here: Re: if...else - in which order « PHP Programming Language « IT news, forums, messages
Re: if...else - in which order

Posted by David Gillen on 11/02/06 14:27

An noise sounding like Sonnich said:
> this is probably an old topic:
>
> if(a==1)
> if(b==2)
> echo "a is 1 and b is 2";
> else
> // what happens here?
> echo "a is 1 and b is not 2";
>
Simplify your code by writing more, but it will help you.
if(a==1 && b==2)
{

}
elseif(a==1 && b!=2)
{

}
else....

etc.

Nesting if's just leads to confusion in the long run. Esp 2 months later when
you're looking back at something. Do it the way suggested above and you'll
help to avoid confusion, and will benefit from readability in your code too.

D.
--

/(bb|[^b]{2})/
Trees with square roots don't have very natural logs.
What's the difference between ignorance and apathy? Who knows? Who cares?

 

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

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