<?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;
?>
<<<TAG
is called 'here document' or
'heredoc'
if you want to search information howto use
TAG;
You CAN NOT use same name for two use in same script.
Each instance of heredoc in a script, also in eventual include( 'script.php' ),
needs to have its own unique tag
In your case you can use:
<<<HTML_END1
HTML_END1;
<<<HTML_END2
HTML_END2;
===========================
The CORRECT use of HERE DOCUMENT, like my code above
with some examples can be found
in php.net MANUAL
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
.