3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test(object $f) { var_dump($f); } class Foo {} $x = new Foo; test($x);
based on Oj1oj
Output for 7.2.0
object(Foo)#1 (0) { }
Output for 7.0.0 - 7.1.10
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of object, instance of Foo given, called in /in/KqXuh on line 11 and defined in /in/KqXuh:3 Stack trace: #0 /in/KqXuh(11): test(Object(Foo)) #1 {main} thrown in /in/KqXuh on line 3
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Catchable fatal error: Argument 1 passed to test() must be an instance of object, instance of Foo given, called in /in/KqXuh on line 11 and defined in /in/KqXuh on line 3
Process exited with code 255.