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