Re: [RFC proposal] Syntactic sugar for array push()
| From: | Dušan Kreheľ | Date: | Thu, 16 Apr 2026 15:04:45 +0000 |
| Subject: | Re: [RFC proposal] Syntactic sugar for array push() | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-130661@lists.php.net to get a copy of this message | ||
Can someone create 2 votes?:
- [-] for array_pop
- [+] for array_push
I don't have an account and rights; and let the discussion have a practical
outcome (whether with a positive or negative result)?
D. K.
ne 14. 9. 2025 o 1:45 Morgan <weedpacket@varteg.nz> napísal(a):
> On 2025-09-13 22:21, Rowan Tommins [IMSoP] wrote:
> > On 12 September 2025 20:02:04 BST, "Dušan Kreheľ"
> > <dusankrehel@gmail.com>
> wrote:
> >
> > Since we have an extremely well-established array_push shorthand, so
> don't need a new one, we could perhaps have "<" for "at start", and
> "-" for
> "pop":
> >
> > $foo[<] = $toUnshift;
> > $shifted = $foo[-<];
> >
>
> Which looks like it would
>
> $foo[0] $foo[1] $foo[2] <-- put $toUnShift here
>
> rather than
>
> put $toUnshift here --> $foo[0] $foo[1] $foo[2]
>