string html_entity_decode(string $text [, int $quoting_style [, string $characters] ])
(PHP 4 >= 4.3.0, PHP 5)
| $text | Source string to decode HTML entities. |
|---|---|
| $quoting_style | Controls the decoding of quote characters (see below). |
| $characters | The character set to use when decoding the string (see below). |
| RETURNS | The source string with HTML encodings removed (decoded). |
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. |
Possible Values for $characters
| ISO-8859-1 | Western European, Latin-1 |
|---|---|
| ISO-8859-15 | Western European, Latin-9. Adds the Euro sign, French and Finnish letters missing in Latin-1(ISO-8859-1). |
| UTF-8 | ASCII compatible multi-byte 8-bit Unicode. |
| cp866 | DOS-specific Cyrillic charset. This charset is supported in 4.3.2. |
| cp1251 | Windows-specific Cyrillic charset. This charset is supported in 4.3.2. |
| cp1252 | Windows specific charset for Western European. |
| KOI8-R | Russian. This charset is supported in 4.3.2. |
| BIG5 | Traditional Chinese, mainly used in Taiwan. |
| GB2312 | Simplified Chinese, national standard character set. |
| BIG5-HKSCS | Big5 with Hong Kong extensions, Traditional Chinese. |
| Shift_JIS | Japanese |
| EUC-JP | Japanese |
This function does the opposite of htmlentities in that it decodes HTML encoded text. 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.
// decode HTML-encoded text echo('Decoded text: ' . html_entity_decode($str));