3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { private $callable; public function __construct() { $this->callable = function () { echo "hello world!"; }; } public function yesItDoes() { $this->callable->call('p'); } } (new Foo)->yesItDoes();
based on K14qb
Output for 7.0.0 - 7.2.0
Warning: Closure::call() expects parameter 1 to be object, string given in /in/jGCWE on line 12
Output for 5.4.11 - 5.6.28
Fatal error: Call to undefined method Closure::call() in /in/jGCWE on line 12
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/jGCWE on line 16
Process exited with code 255.