|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-02-19 21:48 UTC] caelan89 at gmail dot com
Description: ------------ A wise person by the handle of "nikic" once said to me: "Pro tip: Don't be a total dick in your bug reports, and you might get a more information reply next time." He is totally right. Don't be me. Don't go barging in with such an arrogant and demeaning tone. It does a disservice to all parties involved. See: https://bugs.php.net/bug.php?id=79285&edit=2 Please, if you would accept my apology, I am eager to discuss this feature: --- You've added array unpacking inside of arrays. However, I feel that it could benefit from an additional feature. You do not allow this: $a1 = [ 'test' => 1 ]; $a2 = [ 'test-2' => 2 ]; $a3 = [ ...$a1, ...$a2 ]; From my understanding, it would be semantically equivalent to: $a3 = array_merge($a1, $a2); Test script: --------------- $a1 = [ 'test' => 1 ]; $a2 = [ 'test-2' => 2 ]; $a3 = [ ...$a1, ...$a2 ]; PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 16:00:01 2025 UTC |
I never knew PHP supported this - this kind of renders any real necessity outside of "might as well do it anyway" quite moot. $a1 = [ 'one' => 'foo' ]; $a2 = [ 'one' => 'bar', 'two' => 2 ]; $a3 = $a1 + $a2; var_dump($a3); // Yields: // // array(2) { // ["one"]=> // string(3) "foo" // ["two"]=> // int(2) // }