Re: Inline switch as alternative to nested inline conditional
| From: | Mark Randall | Date: | Wed, 16 Oct 2019 02:38:45 +0000 |
| Subject: | Re: Inline switch as alternative to nested inline conditional | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107552@lists.php.net to get a copy of this message | ||
On 16/10/2019 02:46, David Rodrigues wrote:
Hello. I like to suggests a discussion about a FR to make possible to inline switch, as an alternative to nested inline conditionals.
<?php
$value = (function($x) {
switch ($x) {
case 1:
return 'number 1';
case 2:
return 'number 2';
default:
return 'dunno';
}
})(1);
echo $value;
Depends on how many times you need to call it if this works for you or not.