PHP/String/here document
Содержание
Concatenation with a here document
<?
$html = <<< END
<div class="$divClass">
<ul class="$ulClass">
<li>
END
. $listItem . "</li></div>";
print $html;
?>
Defining a here document
<?
print <<< END
Line 1:
Line 2
END;
?>
Interpolating in a here document
<?
$page_title = "Menu";
$meat = "pork";
$vegetable = "vvv";
print <<<MENU
<html>
<head><title>$page_title</title></head>
<body>
<ul>
<li> $meat
<li> $meat
<li> $meat with $vegetable
</ul>
</body>
</html>
MENU;
?>
More here documents
<?
print <<< PARSLEY
line 1:
line
line
line
PARSLEY;
print <<< DOGS
line
line!
DOGS;
?>
Printing HTML with a here document
<?
print <<< HTML
There are <b>5</b> left.
<p>
HTML;
?>