string htmlspecialchars_decode(string $text [, int $quoting_style ])
(PHP 5 >= 5.10)
| $text | Source string to decode special HTML characters. |
|---|---|
| $quoting_style | Controls the encoding of quote characters (see below). |
| RETURNS | The source string with HTML encodings decoded (removed). |
Possible values for $quoting_style
| ENT_COMPAT | Convert only double quotes and don't convert single-quotes. |
|---|---|
| ENT_QUOTES | Convert all types of quotes (both double and single). |
| ENT_NOQUOTES | Don't convert any quote characters in the source string. |
This function decodes all HTML encoded text that was encoded using htmlspecialchars. Text needs to be HTML encoded when it contains special characters that are used for HTML like angle brackets (< and >) that you don't want to be interpreted as HTML by the web browser.
This function only does basic HTML characters which are angle brackets (< and >), quotes (“ and '), and the ampersand (&).
// HTML decode text echo('Decoded text: ' . htmlspecialchars_decode($str));