PHP htmlspecialchars_decode Function

What is htmlspecialchars_decode Function?


In PHP, this function is used to convert special HTML entities back to characters.



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 :

$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);
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.


Please use "View Source" to know the exact output of the function

PHP Topics

Ask Questions

Ask Question