Is it possible with php to directly call a callback stored in an member variable of a class? currently I'm using a workaround, where I'm temporarily storing my callback to a local var.
class CB {
private $cb;
public function __construct($cb) {
$this->cb = $cb;
}
public function call() {
$this->cb(); // does not work
$cb = $this->cb;
$cb(); // does work
}
}
php complains that $this->cb()
is not a valid method, i.e. does not exist.