3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test(stdClass ...$classes) { var_dump($classes); } test(new stdClass, new stdClass); test(new stdClass, 1, 2);
based on A7vQu
Output for 7.0.0 - 7.2.0
array(2) { [0]=> object(stdClass)#1 (0) { } [1]=> object(stdClass)#2 (0) { } } Fatal error: Uncaught TypeError: Argument 2 passed to test() must be an instance of stdClass, integer given, called in /in/B0CtU on line 9 and defined in /in/B0CtU:3 Stack trace: #0 /in/B0CtU(9): test(Object(stdClass), 1, 2) #1 {main} Next TypeError: Argument 3 passed to test() must be an instance of stdClass, integer given, called in /in/B0CtU on line 9 and defined in /in/B0CtU:3 Stack trace: #0 /in/B0CtU(9): test(Object(stdClass), 1, 2) #1 {main} thrown in /in/B0CtU on line 3
Process exited with code 255.
Output for 5.6.7 - 5.6.28
array(2) { [0]=> object(stdClass)#1 (0) { } [1]=> object(stdClass)#2 (0) { } } Catchable fatal error: Argument 2 passed to test() must be an instance of stdClass, integer given, called in /in/B0CtU on line 9 and defined in /in/B0CtU 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/B0CtU on line 3
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '.', expecting '&' or T_VARIABLE in /in/B0CtU on line 3
Process exited with code 255.