3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function add($a, $b, $c, $d) { return $a + $b + $c; } $operators = [2, 3]; echo add(1, ...$operators);
based on GjX6S
Output for 7.1.0
Fatal error: Uncaught ArgumentCountError: Too few arguments to function add(), 3 passed in /in/vVfPX on line 7 and exactly 4 expected in /in/vVfPX:2 Stack trace: #0 /in/vVfPX(7): add(1, 2, 3) #1 {main} thrown in /in/vVfPX on line 2
Process exited with code 255.
Output for 5.6.0 - 5.6.28, 7.0.0 - 7.0.14
Warning: Missing argument 4 for add(), called in /in/vVfPX on line 7 and defined in /in/vVfPX on line 2 6
Output for hhvm-3.10.0 - 3.13.2
Warning: add() expects exactly 4 parameters, 3 given in /in/vVfPX on line 3 6
Output for 5.4.0 - 5.5.38
Parse error: syntax error, unexpected '.' in /in/vVfPX on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/vVfPX on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/vVfPX on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vVfPX on line 6
Process exited with code 255.