To show HTML source code as text, escape characters that would otherwise be parsed as markup. The most important are < as <, > as >, and & as &.
<a href="https://www.plus2net.com/">HTML Tutorials</a>
If you place literal <h1> in an HTML document, the browser treats it as an element. To teach or display the markup itself, write the encoded characters or generate the escaped text on the server.
Paste HTML below. The result is escaped for safe display inside a page. Line breaks are preserved by the <pre> element, so no extra <br> conversion is required.
For dynamic text, PHP's htmlspecialchars() is normally the right tool when outputting user-controlled text into HTML.
<?php
echo htmlspecialchars($text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8');
?>
HTML to PHP converter PHP converter demo
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| smo1234 | 19-03-2012 |
| good script, I am using this regularly | |
| Sam | 10-03-2013 |
| "Great Code" to make a website with HTML tutorials like this website | |
| marv | 27-09-2013 |
| thanks, it works very well and is a nice timesaver for displaying snippets online | |
| Jay | 04-10-2013 |
| Very helpful, thanks. | |
| Mayesh | 22-11-2013 |
| It is very useful Thankq plus2net | |
| Connie | 10-09-2014 |
| Thank you so much. What a time saver! | |
| Shiju | 30-09-2014 |
| This is really good..Thanks..! | |
| Andy | 14-11-2014 |
| Very useful tutorial. Saved so much time. Thanks...! | |
| Rajesh | 29-04-2015 |
| Awesome tool .... Saved so much time ... Thanks !!!! | |