3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $x; function __construct(){ $this->x = function(){echo "x";}; } function __call($name, $arguments) { if($name instanceof Closure){ call_user_func_array($this->name, $arguments); } } } $o->{"x"}();
based on 4bA9H
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: o in /in/rKeJr on line 19 Fatal error: Uncaught Error: Call to a member function x() on null in /in/rKeJr:19 Stack trace: #0 {main} thrown in /in/rKeJr on line 19
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: o in /in/rKeJr on line 19 Fatal error: Uncaught Error: Call to a member function x() on unknown in /in/rKeJr:19 Stack trace: #0 {main} thrown in /in/rKeJr on line 19
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: o in /in/rKeJr on line 19 Fatal error: Call to a member function x() on null in /in/rKeJr on line 19
Process exited with code 255.
Output for 5.3.20 - 5.5.35
Notice: Undefined variable: o in /in/rKeJr on line 19 Fatal error: Call to a member function x() on a non-object in /in/rKeJr on line 19
Process exited with code 255.