array_push would only be used if there were a [-] in the code, i.e. a
hyphen (or plus for pop()) as pseudo-constant.

Practically, it would change today's behavior that returns an error into a
correct operation:
<?php
$a=[3];
$a[+]=2;

// PHP Parse error:  syntax error, unexpected token "]" in … on line 3



pi 12. 9. 2025 o 12:19 Dušan Kreheľ <[email protected]> napísal(a):

> A proposal to add syntactic sugar for array_push() in PHP.
>
> Syntax:
> // now
> array_push($array, 1);
>
> // new syntax
> $array[+]=1;
>
> Dušan Kreheľ
>
>

Reply via email to