3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $secret = 'I actually prefer coding with Go'; public function getClosure() : closure { return function() { return $this->secret; }; } public function dontLeakMyStuff() { return create_function('', 'return $this->secret;'); } } $foo = new Foo(); $closure = $foo->getClosure(); var_dump($closure()); $function = $foo->dontLeakMyStuff(); var_dump($function());

preferences:
32.83 ms | 404 KiB | 5 Q