|
|
PHP htmlspecialchars_decode Function
|
Tutorials » Php »
|
Topic |
What is htmlspecialchars_decode Function?
|
|
Explanation |
|
In PHP, this function is used to convert special HTML entities back to characters.
Syntax:
htmlspecialchars_decode(string,quotestyle)
In the above syntax "string" specifies the text to decode, "quotestyle" specifies how to decode single and
double quotes,some of the characters are that are converted are &= "&", "= "" ", '= "'", <= "<", >= ">".
Example:
<html>
<body>
<?php
$str = "Hiox & amp; & #039;India& #039;";
echo htmlspecialchars_decode($str, ENT_COMPAT);
echo "<br />";
echo htmlspecialchars_decode($str, ENT_QUOTES);
echo "<br />";
echo htmlspecialchars_decode($str, ENT_NOQUOTES);
?>
</html>
</body>
Result:
Hiox & 'India' Hiox & 'India' Hiox & 'India'
In the above example the diffrent quote styles are used to get the characters from the html entities.
NOTE:
Please use "View Source" to know the exact output of the function>
|
|
A Note |
Learn PHP programming language tutorial with simple and neat example. Hope you enjoy this free tutorial.
Do give us your valuable feedback and suggestions on this online tutorial. This is a Copyright Content.
|
|
|
|