I am generating a bit of code to display a picture as a link (frex <a href="site.com"><img src="/image.gif"></a>
) I would like to show how it look, but also in a textbox adjacent show the actual code. Is there a function in PHP that will automagically escape HTML code so it can be displayed?
print "<textarea>" . htmlspecialchars($html) . "</textarea>";
Here you can find details about htmlspecialchars from official documentation.