[php-src] Issue #11204: Improve syntax of creating associative array();
| From: | interduo | Date: | Sun, 07 May 2023 11:25:17 +0000 |
| Subject: | [php-src] Issue #11204: Improve syntax of creating associative array(); | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244395@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11204
Author: interduo
### Description
I see some cleaner way to declare associative arrays:
This working code:
```
$array1 = [
'key1' => false,
'key2 => false,
'key3' => false,
'key4' => false,
'key5' => false,
'key6' => false
];
```
Could be like that (now it's not working in PHP):
```
$array1 = [
('key1', 'key2', 'key3', 'key4', 'key5',
'key6') => false,
];
print_r($array1);
Array
(
[key1] =>
[key2] =>
[key3] =>
[key4] =>
[key5] =>
[key6] =>
)
```
Simple and no repeats.