Array spread append

From: Date: Wed, 05 Apr 2023 22:12:57 +0000
Subject: Array spread append
Groups: php.internals 
Request: Send a blank email to internals+get-119818@lists.php.net to get a copy of this message
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

« previous php.internals (#119818) next »