function test(...$args) { var_dump($args); }
test(1, 2, 3);
$arr = [...$args];
array(5) {
[0]=>
string(6) "banana"
[1]=>
string(6) "orange"
[2]=>
string(5) "apple"
[3]=>
string(4) "pear"
[4]=>
string(10) "watermelon"
}
pub 2048R/33CFC8B3 2014-01-14 [expires: 2020-01-13]
Key fingerprint = 6E4F 6AB3 21FD C07F 2C33 2E3A C2BF 0BC4 33CF C8B3
uid Ferenc Kovacs <tyrael@php.net>
pub 2048R/90D90EC1 2013-07-18 [expire : 2016-07-17]
Key fingerprint = 0BD7 8B5F 9750 0D45 0838 F95D FE85 7D9A 90D9 0EC1
uid Julien Pauli <jpauli@php.net>
Parse error: syntax error, unexpected '...' (T_ELLIPSIS), expecting ']' in /app/spread-operator.php on line 3
$parts = ['apple', 'pear'];
$fruits = ['banana', 'orange', ...$parts, 'watermelon'];
var_dump($fruits);