htmlspecialchars_decode() function in PHP
Last Updated by Pooja Chikara
0 2434
htmlspecialchars_decode() function of PHP is used to convert predefined HTML entities to normal characters.
It is an inbuilt function of PHP. The return type of this function is string means it returns decoded string.
Note:
Syntax:
htmlspecialchars_decode($string,flags);
here,
1. $string is a PHP string that HTML entities to be decoded into normal characters by this function. It is mandatory.
2. flags used to specify the quotes and document type used by the function. It is an optional parameter. The possible values for this are
For quotes
- ENT_COMPAT
- ENT_QUOTES
- ENT_NOQUOTES
For document type
- ENT_HTML401
- ENT_HTML5
- ENT_XML1
- ENT_XHTML
Example:
<?php $string = "<,>,©,&"; $a=htmlspecialchars_decode($string); echo "Decoded symbols are : <br>"; echo $a; ?>
Output:

Share:
Recommended Topics:
You May Also Like
PHP Examples
News letter
Subscribe To Never Miss an Article From
Comments
Waiting for your comments