3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C { function foo() { return function() { var_export($this); }; } } $c = new C; $c->x = 5; $f = $c->foo(); $f();
based on W80nM
Output for 5.4.11 - 5.6.38, 7.0.0 - 7.3.0
C::__set_state(array( 'x' => 5, ))
Output for hhvm-3.10.1 - 3.22.0
C::__set_state(array( 'x' => 5, ))
Output for 5.3.21 - 5.3.29
Notice: Undefined variable: this in /in/OEgZF on line 6 NULL