3v4l.org

run code in 300+ 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));
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
bool(true) bool(false)

preferences:
67.29 ms | 984 KiB | 5 Q