Re: Re: semicolon terminator for switch cases
| From: | Ilija Tovilo | Date: | Fri, 27 Mar 2020 11:01:19 +0000 |
| Subject: | Re: Re: semicolon terminator for switch cases | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109370@lists.php.net to get a copy of this message | ||
Hi Andrea
The reason this doesn't work anymore:
```
If (false);
echo 'Test';
endif;
```
Is because the semicolon is an empty statement:
https://github.com/php/php-src/blob/9e77d5a9da9e80a1bfe226f60ccb12fd8bf9481c/Zend/zend_language_parser.y#L457
This is still valid code:
```
If (false);
echo 'Test';
```
And it always prints. The two semicolons look the same but behave differently which is why I'm
in favor of deprecating it.
Regards