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 { $foo = (new A\Foo)->foo; ($foo)(null); echo "Done\n"; }
based on qdbc6
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/h20uE on line 17 and defined in /in/h20uE:8 Stack trace: #0 /in/h20uE(17): A\Foo->A\{closure}(NULL) #1 {main} thrown in /in/h20uE on line 8
Process exited with code 255.
Output for 5.4.8 - 5.6.28
Parse error: syntax error, unexpected '(' in /in/h20uE on line 17
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/h20uE on line 16
Process exited with code 255.