Skip to content

short array_push($a,...$b) syntax #10993

@lunter2

Description

@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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions