note 113902 deleted from control-structures.alternative-syntax by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:35:34 +0000 |
| Subject: | note 113902 deleted from control-structures.alternative-syntax by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215213@lists.php.net to get a copy of this message | ||
Note Submitter: timeroot dot alex at gmail dot com
----
The reason for the "workaround" jeremiah mentioned, in the case of the switch statement,
can be understood as follows; in any place where you can have an echo statement (an if block, a
switch's case, whatever), that's where you can have the raw HTML. In PHP this basically
gets handled just like that -- like an echo statement.
In between a switch and a case, though, you can't echo anything. By placing the switch and the
case in two separate blocks of PHP, with a raw HTML newline echo'ed in between them, PHP
basically had to try to find where that statement would be. And it can't be there, hence the
difficulty.