3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ra($test, $boo, $foo, $bar) { $wl = array('test', 'boo', 'foo', 'bar'); $arr = array(); foreach ($wl as $val) { $arr[$val] = $$val; } var_dump($arr); } ra('test','foo', 'bar');
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function ra(), 3 passed in /in/l3rCa on line 12 and exactly 4 expected in /in/l3rCa:3 Stack trace: #0 /in/l3rCa(12): ra('test', 'foo', 'bar') #1 {main} thrown in /in/l3rCa on line 3
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33
Warning: Missing argument 4 for ra(), called in /in/l3rCa on line 12 and defined in /in/l3rCa on line 3 Notice: Undefined variable: bar in /in/l3rCa on line 7 array(4) { ["test"]=> string(4) "test" ["boo"]=> string(3) "foo" ["foo"]=> string(3) "bar" ["bar"]=> NULL }

preferences:
254.59 ms | 402 KiB | 327 Q