Unpack Arrays In Arrays
The ellipsis operator can now be used in arrays, with an effect similar to array_merge(). In particular, the string keys are now supported.
PHP code
<?php
$array = [...['a' => 'foo'], ...['b' => 'bar']];
print_r($array);
?>
Before
PHP Fatal error: Cannot unpack array with string keys
Fatal error: Cannot unpack array with string keys
After
Array
(
[a] => foo
[b] => bar
)
PHP version change
This behavior changed in 8.1.