3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $x = 3; } $foo = new Foo; $foobar = function () { var_dump($this->bar); }; // without the last parameter (optional, defaults to false), we'd get a static, not unbound closure $foobar = $foobar->bindTo(null, 'FooBar', true); $foobar->call($foo); // prints int(3)

preferences:
33.96 ms | 402 KiB | 5 Q