Table of Contents

Syntax

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.

What it Does

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 (&).

Example

// HTML decode text
echo('Decoded text: ' . htmlspecialchars_decode($str));
 
htmlspecialchars_decode.txt · Last modified: Apr 18, 2008 - 2:00pm (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki