(greater than) Syntax htmlspecialchars_decode(str,flags) Parameters str - String flags to decode - specify how quotes are handled and what document type to use. The following is the quote style - ENT_COMPAT - default. Decode double quotes only ENT_QUOTES - Decode double quotes and"/> (greater than) Syntax htmlspecialchars_decode(str,flags) Parameters str - String flags to decode - specify how quotes are handled and what document type to use. The following is the quote style - ENT_COMPAT - default. Decode double quotes only ENT_QUOTES - Decode double quotes and">
Home > Article > Backend Development > htmlspecialchars_decode() function in PHP
html_special_chars_decode() function is used to convert special HTML entities back to characters.
The following is the HTML entity that will be decoded -
& becomes & (ampersand)
"changes to" (double quotation mark)
& #039; becomes ' (single quotation mark)
htmlspecialchars_decode(str,flags)
str - The string to decode
flags - Specifies how quotes are handled and the document type to use.
The following is an example -
Example
<?php $s = "<p>this -> "keyword in programming language</p></p><p>"; echo htmlspecialchars_decode($s); echo htmlspecialchars_decode($s, ENT_NOQUOTES); ?>
The following is the output -
Output
<p>this -> "keyword in programming language</p> <p>this -> "keyword in programming language</p>
The above is the detailed content of htmlspecialchars_decode() function in PHP. For more information, please follow other related articles on the PHP Chinese website!