为什么这个PHP代码有错误? [重复]

The first line of heredoc string must have NO indentation... like this:

    function __construct()
      { 
       $a = some_code();
       $b = some_more_code();
       $x = <<<EOT

line1
line2
line3
line4

EOT;    

        $c = even_more_code();
        $b = still_more_code();
        ...
        ...
        ...

see more here: HEREDOC interfering with code indentation

It looks you have tabs in your code. Check this code below, its working fine for me,

$x = <<<EOT
   line1
   line1
   line1
EOT;
echo $x;

Do not include any spaces or tabs at the end of string i.e. EOT(2nd last line).