3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { protected $bar = 'A bar'; public function getBarDumper() { $that = $this; return function() use ($that) { var_dump($that->bar); }; } } $foo = new foo(); $bar = $foo->getBarDumper(); $bar(); ?>

preferences:
35.31 ms | 402 KiB | 5 Q