[php-src] Issue #9561: support the `match` operator in constant expressions
| From: | claudepache | Date: | Fri, 16 Sep 2022 16:24:50 +0000 |
| Subject: | [php-src] Issue #9561: support the `match` operator in constant expressions | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242429@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9561
Author: claudepache
### Description
The following is supported (https://3v4l.org/gUPpH):
```php
const FOO = PHP_INT_SIZE === 8 ? '64bit' : (PHP_INT_SIZE === 4 ? '32bit' : throw
new \Error('unexpected'));
```
I’d like to write (https://3v4l.org/FRO6A):
```php
const FOO = match (PHP_INT_SIZE) { 8 => '64bit', 4 => '32bit' };
```