Name

htmlentities

Synopsis

string htmlentities(string string[, int style[, string encoding]])

Converts all characters in string that have special meaning in HTML and returns the resulting string. All entities defined in the HTML standard are converted. If supplied, style determines the manner in which quotes are translated. The possible values for style are:

ENT_COMPAT (default)

Converts double quotes but not single quotes

ENT_NOQUOTES

Does not convert either double quotes or single quotes

ENT_QUOTES

Converts both single and double quotes

If supplied, encoding determines the final encoding for the characters. The possible values for encoding are:

ISO-8859-1 (default)

Cp1251

GB2312

ISO-8859-15

Cp1252

BIG5-HKSCS

UTF-8

KOI8-R

Shift_JIS

Cp866

BIG5

EUC-JP

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.