Would it be possible to initialize a protected SplObjectStorage
as a map within a class? I seem to be running into an error whenever I try this. Similar to example below:
class a {
protected $a = new SplObjectStorage();
...
}
Would it be possible to initialize a protected SplObjectStorage
as a map within a class? I seem to be running into an error whenever I try this. Similar to example below:
class a {
protected $a = new SplObjectStorage();
...
}
you need to use constructor
class a {
public function __construct() {
$this->a = new SplObjectStorage();
}
protected $a;
...
}