Reply to Re: if...else - in which order

Your name:

Reply:


Posted by Jerry Stuckle on 11/01/06 12:57

Sonnich wrote:
> 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";
>
> The question is, where the else will react too. Usually it should be
> the last if.
>
> In general I put {} around just to be sure.
>
> BR
> Sonnich
>

'else' clauses are always matched with the first unpaired 'if' preceding
them.

Using braces does make things clearer, though.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original 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

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