@Cameron html:
, , , , , heredoc htmlspecialchars() (PHP), . Heredoc .
echo <pre><code>...</code></pre>.
, .
:
<?php
$code = <<< EOT
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<img src="image.png" />
</body>
</html>
EOT;
?>
<pre>
<code class="html">
<?php echo htmlspecialchars( $code ); ?>
</code>
</pre>
One note about using heredoc is that your closure EOTshould be completely left aligned.
Jonny source
share