note 10366 deleted from control-structures.alternative-syntax by betz
| From: | betz@php.net | Date: | Thu, 31 Mar 2005 11:59:50 +0000 |
| Subject: | note 10366 deleted from control-structures.alternative-syntax by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-87261@lists.php.net to get a copy of this message | ||
Note Submitter: justin at iqmail dot net
----
This is also relevant when mixing styles and interspersing PHP with HTML. The following example
gives a syntax error since it associates the else with the inner if.
<?php
if (condition):
// code
if (another_condition) {
// multi-line code
}
else:
?>
[html here]
<?php
endif;
?>
A way around this is to not mix syntax, and change the inner if to the alternate colon-based syntax.
-jcl-