3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo(Bar ...$bars) { print_r($bars); } class Bar {} $a = [ new Bar(), new Bar(), new Bar(), ]; foo($a);
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of Bar, array given, called in /in/k2XOs on line 15 and defined in /in/k2XOs:3 Stack trace: #0 /in/k2XOs(15): foo(Array) #1 {main} thrown in /in/k2XOs on line 3
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Catchable fatal error: Argument 1 passed to foo() must be an instance of Bar, array given, called in /in/k2XOs on line 15 and defined in /in/k2XOs on line 3
Process exited with code 255.
Output for 5.4.0 - 5.5.35
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /in/k2XOs on line 3
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE in /in/k2XOs on line 3
Process exited with code 255.