O'Reilly logo

Programming PHP, 3rd Edition by Peter MacIntyre, Kevin Tatroe, Rasmus Lerdorf

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

htmlentities

Synopsis

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

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

ENT_SUBSTITUTE

Replace invalid code unit sequences with a Unicode Replacement Character

ENT_DISALLOWED

Replace invalid code points for the given document type with a Unicode Replacement Character

ENT_HTML401

Handle code as HTML 4.01

ENT_XML1

Handle code as XML 1

ENT_XHTML

Handle code as XHTML

ENT_HTML5

Handle code as HTML 5

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

ISO-8859-1

Western European, Latin-1.

ISO-8859-5

Cyrillic charset (Latin/Cyrillic), rarely used.

ISO-8859-15

Western European, Latin-9. Adds the Euro sign, French and Finnish letters missing in Latin-1.

UTF-8

ASCII-compatible multi-byte 8-bit Unicode.

cp866

DOS-specific Cyrillic charset.

cp1251

Windows-specific Cyrillic charset.

cp1252

Windows-specific charset for Western European.

KOI8-R

Russian.

BIG5

Traditional Chinese, mainly used in Taiwan.

GB2312

Simplified Chinese, national standard character set.

BIG5-HKSCS

Big5 with Hong Kong ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required