How do I display the source code inside my PHP page without it being interpreted?

Asked

Viewed 47 times

0

You guys, good morning!

I am taking a PHP course and in order to make it easier for future queries, I would like to create a page as if it were a library so that I can consult excerpts of the code with comments and how works that excerpt, and for that I want the code itself to be displayed on the screen without being interpreted, just as it works here in stack overflow.

Below is a picture of what exactly I want, an interpreter that displays the code, I already searched but found nothing.

Editor of the Stack overflow

inserir a descrição da imagem aqui

Displaying on the page without being interpreted:

inserir a descrição da imagem aqui

  • 1

    Just write using HTML. "<" is not a valid HTML character, &lt; is the correct one. The same goes for every special character for HTML, it needs the correct spelling.

1 answer

1

Replaces the < character with the code &lt; and > with &gt;.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.