3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($a, $b) { echo "In foo; a is $a and b is $b\n"; } function bar($args) { echo "In bar; args is ", var_export($args, true), "\n"; foo(...$args); } function baz(...$args) { echo "In baz; args is ", var_export($args, true), "\n"; foo(...$args); } bar(['b'=> 'bee', 'a' => 'wahey']); baz(b: 'bee', a: 'wahey');
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
In bar; args is array ( 'b' => 'bee', 'a' => 'wahey', ) In foo; a is wahey and b is bee In baz; args is array ( 'b' => 'bee', 'a' => 'wahey', ) In foo; a is wahey and b is bee
Output for 7.4.0 - 7.4.33
Parse error: syntax error, unexpected ':', expecting ')' in /in/fvLVE on line 18
Process exited with code 255.

preferences:
152.46 ms | 401 KiB | 123 Q