title: Why do these Heredoc and Nowdoc cause errors?
body: <p>I've already found some solutions, but can't know what happened...</p>
  
  <p>Example 1:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; EOD
  test
  EOD;
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; 'EOD'
  test
  EOD;
  </code></pre>
  
  <p>Output 1,2:</p>
  
  <pre><code>PHP Parse error:  syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)
  </code></pre>
  
  <p>Example 3:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; EOD
  test
  EOD;
  
  ?&gt;
  </code></pre>
  
  <p>Example 4:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; 'EOD'
  test
  EOD;
  
  ?&gt;
  </code></pre>
  
  <p>Example 5:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; EOD
  test
  EOD;
  'dummy';
  </code></pre>
  
  <p>Example 6:</p>
  
  <pre><code>&lt;?php
  
  echo &lt;&lt;&lt; 'EOD'
  test
  EOD;
  'dummy';
  </code></pre>
  
  <p>Output 3,4,5,6:</p>
  
  <pre><code>test
  </code></pre>