htmlspecialchars() in php

The htmlspecialchars() function converts characters that have a special meaning in HTML to their HTML entity equivalent

For example, the character < is converted to the entity <

The prototype of this function is as follows:

string htmlspecialchars (string string [, int flags = ENT_COMPAT | ENT_HTML401
[, string encoding = ‘UTF-8’ [, bool double_encode = true ]]])

HTML Entities Encoded by the htmlspecialchars() Function

CharacterTranslation
&&amp;
&quot;
&apos;
<&lt;
>&gt;
HTML Entities Encoded by the htmlspecialchars() Function

Leave a Comment