Req #80421 [Opn]: Splat operator could support associative arrays

From: Date: Tue, 03 Aug 2021 13:08:12 +0000
Subject: Req #80421 [Opn]: Splat operator could support associative arrays
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235560@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80421&edit=1

 ID:                 80421
 Updated by:         ramsey@php.net
 Reported by:        david at grudl dot com
 Summary:            Splat operator could support associative arrays
 Status:             Open
 Type:               Feature/Change Request
 Package:            Arrays related
-PHP Version:        8.1
+PHP Version:        8.2
 Block user comment: N
 Private report:     N

 New Comment:

8.1 is in feature freeze now, so now the earliest this could happen is 8.2.


Previous Comments:
------------------------------------------------------------------------
[2020-11-26 02:09:16] requinix@php.net

Actually, going to leave this Open since the RFC is six years old.

------------------------------------------------------------------------
[2020-11-26 02:07:48] requinix@php.net

Proposed but not in active discussion.
https://wiki.php.net/rfc/additional-splat-usage

8.0 is about to release so the earliest this could happen is 8.1.

------------------------------------------------------------------------
[2020-11-26 01:56:40] david at grudl dot com

Description:
------------
Now is possible to use splat operator with associative array when calling functions:

func(...['a' => 1, 'b' => 2])


It would be nice if it worked the same way in arrays:

$a = [  ...['a' => 1, 'b' => 2]  ];

Now it triggers fatal error: Cannot unpack array with string keys 



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80421&edit=1


Thread (4 messages)

« previous php.bugs (#235560) next »