← All built-ins / htmlspecialchars()
htmlspecialchars()
htmlspecialchars(string $s): string
Parameters
| Name | Type | Description |
|---|---|---|
| $s | string | text to escape |
Return value
The text with only the five HTML-critical characters (& " ' < >) escaped.
Example
echo htmlspecialchars("<a href=\"x\">link</a>");<a href=\"x\">link</a>