Re: Suggestion: Inconsistency: Allow array spread operator to work on string keys
| From: | Côme Chilliet | Date: | Thu, 03 Dec 2020 08:40:25 +0000 |
| Subject: | Re: Suggestion: Inconsistency: Allow array spread operator to work on string keys | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112392@lists.php.net to get a copy of this message | ||
Le Wed, 2 Dec 2020 17:45:47 +0000,
"G. P. B." <george.banyard@gmail.com> a écrit :
> The reason why this has been deferred is because of which semantics should
> be used for duplicate string keys.
['a' => 1, ...['a' => 2]] should be the same as ['a' => 1,
'a' => 2], I do not
see how any other way would be justifiable.
This means using array_merge semantic, as ['a' => 1, 'a' => 2] evaluates
to
['a' => 2].