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
.
Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.