title: PHP Heredoc string rules
body: <p>Can someone here explore the intricacies of using <a href="https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc" rel="noreferrer">heredoc</a> in PHP using example PHP code snippets, based on what the manual says below?</p>
  <p>The php.net manual says:</p>
  <blockquote>
  <p>It is very important to note that the line with the closing identifier must contain no other characters, except possibly a semicolon (<code>;</code>). That means especially that the identifier may not be indented, and there may not be any spaces or tabs before or after the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by the local operating system. This is <code>\n</code> on UNIX systems, including Mac OS X. The closing delimiter (possibly followed by a semicolon) must also be followed by a newline.</p>
  <p>If this rule is broken and the closing identifier is not &quot;clean&quot;, it will not be considered a closing identifier, and PHP will continue looking for one. If a proper closing identifier is not found before the end of the current file, a parse error will result at the last line.</p>
  <p>Heredocs can not be used for initializing class properties. Since PHP 5.3, this limitation is valid only for heredocs containing variables.</p>
  </blockquote>
  <p>Here is the link to PHP manual: <a href="http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc" rel="noreferrer">http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc</a></p>