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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
39 - 9 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 13:01:27 2024 UTC