Req #80421 [Opn]: Splat operator could support associative arrays
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)