Re: [RFC] Disallow multiple default blocks in a single switch statement
| From: | Stas Malyshev | Date: | Thu, 14 Aug 2014 00:33:51 +0000 |
| Subject: | Re: [RFC] Disallow multiple default blocks in a single switch statement | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-76502@lists.php.net to get a copy of this message | ||
Hi!
> And this, which is completely undetectable at parse time:
>
> $bar = 30;
> // ... arbitrary amount of code
> switch ( $foo ) {
> case $bar:
> case 30:
> }
That's not all. You can also do:
switch (true) {
case foo($bar):
...
case baz($quz, $qux):
...
}
and this is a completely valid code which I've seen in the field.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/