note 15849 added to control-structures.else
| From: | adi dot bolborici at rdsbv dot ro | Date: | Fri, 05 Oct 2001 10:11:13 +0000 |
| Subject: | note 15849 added to control-structures.else | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-18595@lists.php.net to get a copy of this message | ||
I saw this note a few days ago and nobody answered to the question at the end. I am sure that many
of you know the right answer but, just to be sure that everyone will get the right one i'll
answer the question.
So the message was:
yohgaki@hotmail.com
14-Apr-2001 02:04
Common mistake with "else" is "dangling elseh statement.
Consider following code,
if (<expr>)
if (<expr>)
/* a line of code */
else
/* a line of code */
Is the gelseh belong to first gifh or second gifh statement?
It is more clear if you write the code like this,it's more suggestive.
if (expr)
if (expr)
/* a line of code */
else
/* a line of code */
So else belog to the second if.
--
http://www.php.net/manual/en/control-structures.else.php
http://master.php.net/manage/user-notes.php?action=edit+15849
http://master.php.net/manage/user-notes.php?action=delete+15849
http://master.php.net/manage/user-notes.php?action=reject+15849