3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $c; public function __construct(callable $c) { $this->c = $c; } public function doCb() { ($this->c)(); } private static function bar() { var_dump(__METHOD__); } } $f = new Foo('Foo::bar'); // fine $f->doCb(); // not fine ($f->c)();

preferences:
16.34 ms | 402 KiB | 5 Q