note 75908 deleted from control-structures.else by bjori
| From: | bjori@php.net | Date: | Fri, 14 Dec 2007 20:00:15 +0000 |
| Subject: | note 75908 deleted from control-structures.else by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133478@lists.php.net to get a copy of this message | ||
Note Submitter: robbak
----
Yes, that code is clearly ambiguous. I would think that the code does the 'right thing'
with it anyway. The else should bind to the nearest if.
If you are going to nest ifs, use curly brackets and stay sane.
<?
if ($a == 1)
{ /* nested if */
if ($b == 2) echo '2';
} else
/* other code */
?>