3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace A { class Foo { public $foo; public function __construct() { $this->foo = function (int $a) { var_dump("foo"); }; } } } namespace { ((new A\Foo)->foo)(null); echo "Done\n"; }
based on OEm8O
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to A\Foo::A\{closure}() must be of the type integer, null given, called in /in/tDjfk on line 16 and defined in /in/tDjfk:8 Stack trace: #0 /in/tDjfk(16): A\Foo->A\{closure}(NULL) #1 {main} thrown in /in/tDjfk on line 8
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/tDjfk on line 16
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/tDjfk on line 16
Process exited with code 255.