3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Foo {} function bar(Foo $foo) { return $foo; } bar('I like turtles');
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to bar() must be an instance of Foo, string given, called in /in/f9IgY on line 10 and defined in /in/f9IgY:6 Stack trace: #0 /in/f9IgY(10): bar('I like turtles') #1 {main} thrown in /in/f9IgY on line 6
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/f9IgY on line 2 Catchable fatal error: Argument 1 passed to bar() must be an instance of Foo, string given, called in /in/f9IgY on line 10 and defined in /in/f9IgY on line 6
Process exited with code 255.