PHP htmlspecialchars_decode () instance tutorial
Definition and usage
The htmlspecialchars_decode () function converts some predefined HTML entity characters.
The HTML object is decoded as follows:
& Become & (symbol)
"To" (double quotation marks)
'To' (single quotes)
"Become" (less)
"Become" (greater)
The htmlspecialchars_decode () function is the opposite htmlspecialchars ().
Syntax
Htmlspecialchars_decode (string, quotestyle)
Parameter description
String required. Decodes the specified string.
Quotestyle is optional. Specifies how to decode a single, double quotation marks.
The following quote methods are available:
ENT_COMPAT-default. Double quotation marks
ENT_QUOTES-double and single quotes
ENT_NOQUOTES-no quote decoding
--------------------------------------------------------------------------------
Example 1
<? Php $ str = "Jane & amp; & #039; Tarzan & #039;"; echo htmlspecialchars_decode ($ str); echo "<br/> "; echo htmlspecialchars_decode ($ str, ENT_QUOTES); echo "<br/>"; echo htmlspecialchars_decode ($ str, ENT_NOQUOTES);?> |
Jane & 'tarzance' Jane & 'tarzanc'