3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Priv { private function privateMethod() { return true; } } function myCLosure() { return $this->privateMethod(); } $myClosure = myClosure(); $myClosure = $myClosure->bind(new Priv); echo $myClosure;
based on b7NBT
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Using $this when not in object context in /in/9TQQ3:13 Stack trace: #0 /in/9TQQ3(16): myCLosure() #1 {main} thrown in /in/9TQQ3 on line 13
Process exited with code 255.
Output for 5.3.18 - 5.6.28
Fatal error: Using $this when not in object context in /in/9TQQ3 on line 13
Process exited with code 255.