Name
htmlspecialchars
Synopsis
string htmlspecialchars(stringstring[, intstyle[, stringencoding[, booldouble_encode]]])
Converts characters in string that
have special meaning in HTML and returns the resulting string. A
subset of all HTML entities covering the most common characters is
used to perform the translation. If supplied,
style determines the manner in which quotes
are translated. The characters translated are:
Ampersand (
&) becomes&Double quotes (
") become"Single quote (
') becomes'Less than sign (
<) becomes<Greater than sign (
>) becomes>
The possible values for style are the
same as those for htmlentities. If
supplied, encoding determines the final
encoding for the characters. The possible values for
encoding are the same as those for
htmlentities. When
double_encode is turned off, PHP will not
encode existing htmlentities.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access