3v4l.org

run code in 300+ PHP versions simultaneously
<?php function add($a, $b, $c) { return $a + $b + $c; } $operators = 2; echo add(1, ...$operators);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Fatal error: Uncaught TypeError: Only arrays and Traversables can be unpacked in /in/VUbhp:8 Stack trace: #0 {main} thrown in /in/VUbhp on line 8
Process exited with code 255.
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
Warning: Only arrays and Traversables can be unpacked in /in/VUbhp on line 8 Fatal error: Uncaught ArgumentCountError: Too few arguments to function add(), 1 passed in /in/VUbhp on line 8 and exactly 3 expected in /in/VUbhp:3 Stack trace: #0 /in/VUbhp(8): add(1) #1 {main} thrown in /in/VUbhp on line 3
Process exited with code 255.
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33
Warning: Only arrays and Traversables can be unpacked in /in/VUbhp on line 8 Warning: Missing argument 2 for add(), called in /in/VUbhp on line 8 and defined in /in/VUbhp on line 3 Warning: Missing argument 3 for add(), called in /in/VUbhp on line 8 and defined in /in/VUbhp on line 3 Notice: Undefined variable: b in /in/VUbhp on line 4 Notice: Undefined variable: c in /in/VUbhp on line 4 1
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38
Parse error: syntax error, unexpected '.' in /in/VUbhp on line 8
Process exited with code 255.

preferences:
286.83 ms | 401 KiB | 369 Q