3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public function foo() { return 1; } public function get($context) { $f = function() { var_dump($this->foo(), static::foo()); return $this->foo() === static::foo(); }; $f->bindTo($context); return $f; } } class Baz { public function foo() { return 2; } } $bar = new Bar; $baz = new Baz; var_dump(call_user_func($bar->get($baz)));

preferences:
34.1 ms | 402 KiB | 5 Q