Bug #13026 Updated: if...then...else problem
| From: | derick@php.net | Date: | Wed, 29 Aug 2001 12:45:00 +0000 |
| Subject: | Bug #13026 Updated: if...then...else problem | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-64593@lists.php.net to get a copy of this message | ||
ID: 13026
Updated by: derick
Reported By: k_oss30@hotmail.com
Old Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Red Hat Linux 7.0
PHP Version: 4.0.6
New Comment:
It's not really a bug, but a side-effect of the old syntax. The new one, with { } does not have
this problem, and that's the recommended syntax anyways.
I'll mark this one as bogus.
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-08-29 08:42:10] k_oss30@hotmail.com
hi!
i noticed a problem with nested if...then...else s
Example:
if ($A==1):
if ($B==2) DoThis();
if ($C==3) DoThat();
else:
DoSomething;
endif;
in this case - the 'else:' on thr 4th line is regarded as an 'else' continuing
from the 'if' on the 3rd line.
this generates a parser error.
this may cause confusion to some of you (it did to me) but the workaround is this:
if ($A==1) {
if ($B==2) DoThis();
if ($C==3) DoThat();
} else {
DoSomething;
}
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13026&edit=1