[php-src] Issue #10993: short array_push($a,...$b) syntax
| From: | lunter2 | Date: | Sat, 01 Apr 2023 19:09:04 +0000 |
| Subject: | [php-src] Issue #10993: short array_push($a,...$b) syntax | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244080@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10993
Author: lunter2
### Description
Description:
------------
$a[]=$b is equivalent to array_push($a,$b)
$a[]=...$b should be equivalent to array_push($a,...$b)
Test script:
------------
<?php
$a=[0];
$a[]=...[1,2]; // array_push($a,...[1,2]);
print_r($a);
?>
Expected result:
----------------
Array ( [0] => 0 [1] => 1 [2] => 2 )
Actual result:
--------------
Parse error: syntax error, unexpected '...' (T_ELLIPSIS) in
C:\htdocs\wwwroot\fast_array_push.php on line 4