PHP htmlentities Function
What is htmlentities Function?
Explanation
In PHP, this function is used to convert all applicable characters to HTML entities.
Syntax:
htmlentities(string,quotestyle,character-set)
In the above syntax "string" specifies the text to decode, "quotestyle" specifies how to decode single and double quotes,"characterset" specifies the character set to be used.
Example :
<html>
<body>
<?php
$str = "Hiox & 'India'";
echo htmlentities($str, ENT_COMPAT);
echo "<br />";
echo htmlentities($str, ENT_QUOTES);
echo "<br />";
echo htmlentities($str, ENT_NOQUOTES);
?>
</html>
</body>
Result :
Hiox & 'India'
Hiox & 'India'
Hiox & 'India'
In the above example for string, the diffrent quote styles are used to get the html entities for the given characters
NOTE:
Please use "View Source" to know the exact output of the function>