https://dev.webpages.dk/  
 
PHP htmlspecialchars_decode
How to use htmlspecialchars_decode:

This is an example of using the HTML 'Buttons'.
We here build a row of tabs, that shows different content when the separate buttons are clicked.
You can easily add buttons by adding more lines in the HTML code you find here.
I use this very code on all the pages here on the https://dev.webpages.dk/
In this example we don't use PHP, so that button have been left out. But the site generally presents code in the different web developing languages; HTML, CSS, Javascript and PHP.

 htmlspecialchars_decode

As you read on the other page, about 'htmlspecialchars', your text will be converted from containing HTML tags, into the source code, meaning that f.ex < as the tags begin with, will become &lt;, that is the HTML charactercode for that character. (LessThan).
So the <strong> tag will look like this: &lt;strong&gt;
But it will in the browser be shown this way; <strong>

As your HTML codes will be converted, what can we then do to get it back to as it wa swritten?
To get all this sourcode back we use the other half of this htmlspecialchars PHP code. Its called 'htmlspecialchars_decode', and will do that - decode the encoded string.

So your source code that now looks like this; Here is an example of text &lt;strong&gt;with &lt;U&gt;HTML&lt;/U&gt; tags.&lt;/strong&gt; scan be converted back to having the real tags, as written. This will mean that the code now will not be shown as sourcecode but as genuine HTML tags, so the line will look this way then;
Here is an example of text with HTML tags.

 PHP

 As you see it just takes a single code to strip of the tags. This is built in to PHP, and its a useful code to use.
 The example show the basic use of the htmlspecialchars code.

<?php
   $string = "Here is an example of text &lt;strong&gt;with &lt;U&gt;HTML&lt;/U&gt; tags.&lt;/strong&gt;";
   echo htmlspecialchars_decode($string);
?>
 This will now look like so;

 Here is an example of text with HTML tags.
Icons made by Freepik from www.flaticon.com This snippet is in two parts. First turn all tags and code into charatercodes, and then; decode them. This is part two.
09:35:01