只是在玩,我发现了这个。
为什么引用调用$this->newAxis()
不会抛出未定义的属性通知(属性xAxis
),而var_dump()
会?
public function newXAxis()
{
// var_dump(isset($this->xAxis)); // false
// var_dump($this->xAxis); // Throws the notice
return $this->newAxis($this->xAxis); // Should throw the notice?!
}
protected function newAxis(&$current)
{
// ...
}
它是否与通过引用传递有关,因此不直接访问该属性?