On 6-4-2023 0:12, Vorisek, Michael wrote:
Hello,

I would like to open a discussion for 
https://github.com/php/php-src/issues/10791 .
[https://opengraph.githubassets.com/a23cb565cc8acac6a33ecab5d9ee68a46f046a1ffe215501673156e506695430/php/php-src/issues/10791]<https://github.com/php/php-src/issues/10791>
Array spread append · Issue #10791 · 
php/php-src<https://github.com/php/php-src/issues/10791>
Description Currently spread operator can be used for almost anything. But not for 
array append. I propose the following to be supported: <?php $arr = [1, 2]; 
$arr2 = [3, 4]; $arr[...] = $arr2; // ...
github.com
Appending N elements to an array is quite common language usage pattern and I 
belive it should be supported natively for shorter syntax, language consistency 
and performance.

I am unable to implement it, but I am ready to help with RFC.

Michael Vorisek

I have the feeling I'm missing something, but how would this compare to array join (which is already available and is actually shorter than this) ?

$arr += $arr2;

Smile,
Juliette


Reply via email to