PHP html_entity_decode function


PHP html_entity_decode function : It converts the html entities to its applicable characters. This function decodes all html entities to its equivalent characters. We will explain this function with Syntax, Example And Demo .


Note : It Supports In PHP 4 and above versions.

PHP html_entity_decode function

Here is syntax for html_entity_decode function

Syntax: html_entity_decode function

html_entity_decode(string,flags,char-set);

Input(html_entity_decode) Parameters

Hers are parameters explained –

  • string: This is required input parameter which needs to be decoded.
  • flags: This is optional input parameter which handles single and double quotes. Here are following quote style-
    • ENT_COMPAT : This is default. Converts/Decodes only Double Quotes
    • ENT_QUOTES : This Decodes Both Single and Double Quotes.
    • ENT_NOQUOTES : Decodes neither Single nor Double Quotes.
  • char-set: This is optional parameter. This is basically used to decide which character set to use.
    • UTF-8 : This is Default ASCII Compatible Multi byte 8-bit Unicode.
    • ISO-8859-1 : Western European, Latin-1.
    • ISO-8859-15 : Western European, Latin-9
    • cp866: DOS-specific Cyrillic charset
    • cp1251 : Windows-specific Cyrillic charset.
    • cp1252 : Windows specific charset for Western European
    • KOI8-R : Russian.
    • BIG5 : Traditional Chinese, Specially used in Taiwan.
    • GB2312 : National standard character set.
    • BIG5-HKSCS : Traditional Chinese.
    • Shift_JIS SJIS, SJIS-win, cp932, 932 Japanese
    • EUC-JP :Japanese
    • MacRoman : Charset that was used by Mac OS.

Return(html_entity_decode) Parameters

Returns the decoded string.

PHP html_entity_decode function

Here is very basic example of html_entity_decode function –

html entity decode function Example:

PHP html_entity_decode function

Try It>>

If you run the above example it produce the following example as below-

PHP html_entity_decode function


Advertisements

Add Comment

📖 Read More