Name
htmlspecialchars
Synopsis
string htmlspecialchars(stringstring
[, intstyle
])
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:
| Converts double quotes but not single quotes |
| Does not convert either double quotes or single quotes |
| Converts both single and double quotes |
Get Programming PHP, 2nd 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.