The following php code will throw an error:
class Foo{
public $bar = <<<EOF
{$this->foobar}
EOF;
public $foobar = "123";
public function echoBar(){
echo $this->bar;
}
}
It doesn't even have to be in brackets, any attempt at variable substitution throws an error.
Can someone explain why? Putting the heredoc inside a function fixes the error, but I was wondering what causes this.
Version of php shell is Zend Engine v2.3.0.