xref: /PHP-8.2/Zend/tests/arg_unpack/new.phpt (revision d3b484df)
1--TEST--
2Unpack arguments for new expression
3--FILE--
4<?php
5
6class Foo {
7    public function __construct(...$args) {
8        var_dump($args);
9    }
10}
11
12new Foo(...[]);
13new Foo(...[1, 2, 3]);
14new Foo(...[1], ...[], ...[2, 3]);
15
16?>
17--EXPECT--
18array(0) {
19}
20array(3) {
21  [0]=>
22  int(1)
23  [1]=>
24  int(2)
25  [2]=>
26  int(3)
27}
28array(3) {
29  [0]=>
30  int(1)
31  [1]=>
32  int(2)
33  [2]=>
34  int(3)
35}
36