What is the use of <<<EOD in PHP?

I am implementing node to PDF using Drupal and tcpdf. In such case I am suppose to use this <<<EOD tag. If I don't use it, it throws error. I can't exactly get the purpose of <<<EOD.

Could anybody please explain the concept of this?

$html = <<<EOD
        <tr>
          <td>TEST</td>
        </tr>
EOD;

That is not HTML, but PHP. It is called the HEREDOC string method, and is an alternative to using quotes for writing multiline strings.

The HTML in your example will be:

    <tr>
      <td>TEST</td>
    </tr>

Read the PHP documentation that explains it.


there are four types of strings available in php. They are single quotes ('), double quotes (") and Nowdoc (<<<'EOD') and heredoc(<<<EOD) strings

you can use both single quotes and double quotes inside heredoc string. Variables will be expanded just as double quotes.

nowdoc strings will not expand variables just like single quotes.

ref: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc