htmlspecialchars -- Convert special characters to HTML entities.


string htmlspecialchars(string string);

Certain characters have special significance in HTML, and should be represented by HTML entities if they are to preserve their meanings. This function returns a string with these conversions made.

This function is useful in preventing user-supplied text from containing HTML markup, such as in a message board or guest book application.

At present, the translations that are done are:

Note that this functions does not translate anything beyond what is listed above. For full entity translation, see htmlentities().

See also htmlentities() and nl2br().