php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #79020 Fast array push $a[]=...[1,2];
Submitted: 2019-12-23 09:29 UTC Modified: 2019-12-23 16:44 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: bugzilla77 at gmail dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: 7.4.1 OS: all
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-12-23 09:29 UTC] bugzilla77 at gmail dot com
Description:
------------
Fast array push $a[]=...[1,2];

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-12-23 09:43 UTC] bugzilla77 at gmail dot com
$a[]=$b is equal to array_push($a,$b)
$a[]=...$b should be equal to array_push($a,...$b)
 [2019-12-23 16:44 UTC] requinix@php.net
-Status: Open +Status: Suspended
 [2019-12-23 16:44 UTC] requinix@php.net
A syntax change like this requires a discussion on the internals mailing list and an RFC. You can find out more about the process on the PHP wiki: https://wiki.php.net/rfc/howto
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 14:01:27 2020 UTC