Re: [RFC] Short Array Variable Shorthand

From: Date: Wed, 30 Sep 2026 13:38:26 +0000
Subject: Re: [RFC] Short Array Variable Shorthand
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-132714@lists.php.net to get a copy of this message
On 29 September 2026 18:44:07 BST, Weilin Du <weilin-du@qq.com> wrote: >Hi folks! > >Today, I want to announce my second RFC to php 8.7 >https://wiki.php.net/rfc/array_shorthand > >This RFC brings a IMO useful syntactic sugar to array's >construction and destruction. I hope you'all find this >interesting! To be short: > >``` >$point = [:$x, :$y, :$z]; // ['x' -> $x, 'y' -> $y, 'z' >-> $z] >[:$x, :$y, :$z] = $point; // reverse. >``` You might be interested in Nikita's thoughts on this back when named parameters were added: https://wiki.php.net/rfc/named_params#future_scope Even if it's only applied to arrays initially, it's useful to consider how the syntax fits with both existing and future features. Rowan Tommins [IMSoP]

« previous php.internals (#132714) next »