3v4l.org

run code in 300+ PHP versions simultaneously
<?php class abc{ public function func() { $x = function() use ($this) { $this->bcg(); }; $x(); } public function bcg() { echo 'HERRO'; } } (new abc)->func();
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.8 - 5.6.14
Fatal error: Cannot use $this as lexical variable in /in/jsksv on line 7
Process exited with code 255.

preferences:
139.9 ms | 998 KiB | 7 Q