Definition
The htmlspecialchars_decode() function converts some predefined HTML entities to characters.
Syntax
htmlspecialchars_decode(string, flags)
Parameters
Parameter | Description |
---|---|
string |
Required. Specifies the string to decode. |
flags |
Optional. Specifies how to handle quotes and which document type to use. The available quote styles are:ENT_COMPAT - Default. Decodes only double quotesENT_QUOTES - Decodes double and single quotesENT_NOQUOTES - Does not decode any quotesAdditional flags for specifying the used doctype: ENT_HTML401 - Default. Handle code as HTML 4.01ENT_HTML5 - Handle code as HTML 5ENT_XML1 - Handle code as XML 1ENT_XHTML - Handle code as XHTML |
Example
<?php
$str = "This is <b>bold</b> text.";
echo htmlspecialchars_decode($str);