Use htmlentities() to make it safe and visible.
There are a number of code displayers. Usually a mixture of CSS and JS. I've used syntaxhighlighter in the past, amongst others. Plenty to chose from.
diafol
Rhod Gilbert Fan (ardav)
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080