Re: Little switch improvement: get the used variable
| From: | Sanford Whiteman | Date: | Wed, 24 Sep 2014 21:33:01 +0000 |
| Subject: | Re: Little switch improvement: get the used variable | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77597@lists.php.net to get a copy of this message | ||
You can already do:
$a = 1;
$b = 2;
switch( $switch_value = $a + $b ) {
default:
print $switch_value;
}
No magic or new operator required....
-- S.