2 AnswersNew Answer
You have to replace at least '<' characters with html entities ( '<' is '<' ) to avoid tags to be parsed intead be displayed... You also need to replace at least '&' ( '&' ) to avoid html entities to be parsed and displayed as the charater they represent ;) However, you need to use a good suited container, or style it, for getting expected behaviour of displaying line break as in the source code, and not as default html content behaviour (line break are treated as spaces, and must be explicitly specified by introducing some <br> tags, and multi spaces are collapsed). Example: <pre><code><html> <head> <title>PHP Test</title> </head> <body> <p>Hello world </p> </body> </html> </code></pre> <pre> is a block container default styled to preserve text formating (line breaks, multi-spaces, tabulations...) <code> is an inline container default styled with monospaced font, usually used to display source codes... Try replacing them with a basic <p> or <div> to see how different is the behaviour ;) (you can also try to introduce <br>s to force line-breaks, and to force no collapsable spaces ^^ )
You use the tag <code> to show blocks of code on your webpage.