What code use to display any code on the page? That is, how do I display PHP or any other code on the page so that the browser reads it as text and does not interpret it as code?
What code use to display any code on the page? That is, how do I display PHP or any other code on the page so that the browser reads it as text and does not interpret it as code?
You have to use <
and >
(HTML Entities), something like:
<pre>
<?php
echo 'Olá';
<pre>
You can make this easier by using the htmlspecialchars
function of PHP itself, for example, assuming you are going to read a script and display it:
<pre>
<?php
$dados = file_get_contents('script.php');
echo htmlspecialchars($dados);
?>
</pre>
Enjoy and read about some differences: What's the difference between htmlspecialchars () and htmlentities ()?
I do not know if I understand 100% but it looks like you're looking for something like the highlight_file function.
Example usage: highlight_file ('myFile.php');