htmlspecialchars_decode() function in PHP
0 2076
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:
To converts normal characters to predefined HTML entities, use htmlspecialchars() PHP function.
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:
Comments
Waiting for your comments