Re: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2

This is only part of a thread. view whole thread
April 9, 2019 14:09 (=?ISO-8859-1?Q?C=F4me?= Chilliet)
Le vendredi 5 avril 2019, 11:00:59 CEST Michał Brzuchalski a écrit :
> So we're talking about providing incomplete feature now, right?
As I understand it, the point is to make unpacking available to arrays, to be consistent with function calls. // This is already supported $result = someFunction($a, $b, ...$array); $result = new someClass($a, $b, ...$array); // This is not $result = array($a, $b, ...$array); So when building an object I can unpack, but not when building an array, why? So the feature is designed to work the same way as for function parameters, which is why string keys are not supported, because they are not supported by the "..." operator for functions. In the end, I see that as making a feature more complete, as the "..." operator which only supported functions will now support array constructors as well. Côme