3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Test { public $cb; public function __construct() { // $this->cb is callable here $this->cb = [$this, 'method']; var_dump(is_callable($this->cb)); } private function method() {} } $obj = new Test; // $obj->cb is NOT callable here var_dump(is_callable($obj->cb));

preferences:
44.74 ms | 974 KiB | 5 Q