The function
htmlentities is identical to the function
htmlspecialchars in many ways. But there are some differences in terms of conversions. Following are few differences between
htmlentities and
htmlspecialchars functions:
htmlentities | htmlspecialchars |
1. It converts all applicable characters to HTML entities |
1. It convert special characters to HTML entities |
2. Example
echo htmlentities('.');
// Output:<Il était>.
|
2. Example
echo htmlspecialchars('.');
// Output: <Il était>.
|
3. htmlentities is not good for XML data |
3. htmlspecialchars is useful in case of XML data |
Comments
Post a Comment