<?php
// unpacking arguments
function foo($one, $two, $three) {
echo '<b>' . __FUNCTION__ . '</b>' . PHP_EOL;
dump($one, $two, $three);
echo PHP_EOL;
}
function bar(...$numbers) {
echo '<b>' . __FUNCTION__ . '</b>' . PHP_EOL;
dump($numbers);
echo PHP_EOL;
}
bar(1, 2, 3);
$array = [1, 2, 3];
$traversable = new ArrayIterator($array);
foo(...$array);
foo(...$traversable);
^ array:3 [
0 => 1
1 => 2
2 => 3
]
^ 1
^ 2
^ 3
^ 1
^ 2
^ 3