Strings - Heredoc

A third way to delimit strings is the heredoc syntax: <<<. After this operator, an identifier is provided, then a newline. The string itself follows, and then the same identifier again to close the quotation.

The closing identifier must begin in the first column of the line. Also, the identifier must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore.

<?php
$str 
= <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;

/* More complex example, with variables. */
class 
foo
{
    var 
$foo
;
    var 
$bar
;

    function 
foo
()
    {
        
$this->foo 'Foo'
;
        
$this->bar = array('Bar1''Bar2''Bar3'
);
    }
}

$foo = new foo
();
$name 'MyName'
;

echo <<<EOT
My name is "$name". I am printing some $foo->foo
.
Now, I am printing some 
{$foo->bar[1]}
.
This should print a capital 'A': \x41
EOT;
?>