3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(...$args) { var_dump($args); } test(1, 2, 3); // [1, 2, 3] test(...[1, 2, 3]); // [1, 2, 3] test(...new ArrayIterator([1, 2, 3])); // [1, 2, 3] // Note: It doesn't really make sense to unpack a constant array like [1, 2, 3]. // Normally these would unpack some variable like ...$args

preferences:
66.4 ms | 402 KiB | 5 Q