Current Location: Home> Function Categories> htmlspecialchars_decode

htmlspecialchars_decode

Convert special HTML entities back to normal characters
Name:htmlspecialchars_decode
Category:String
Programming Language:php
One-line Description:Convert some predefined HTML entities into characters.

Definition and usage

The htmlspecialchars_decode() function converts predefined HTML entities into characters.

The HTML entity that will be decoded is:

  • & decoded into & (sum)
  • "Decoded into" (double quotes)
  • 'Decoded into' (single quotes)
  • < decoded to < (less than)
  • > Decode to > (greater than)

htmlspecialchars_decode() function is the inverse function of htmlspecialchars() function.

grammar

 htmlspecialchars_decode ( string , flags )
parameter describe
string Required. Specifies the string to be decoded.
flags

Optional. Specifies how to deal with quotes and which document type to use.

Available quote types:

  • ENT_COMPAT - Default. Decode only double quotes.
  • ENT_QUOTES - Decode double and single quotes.
  • ENT_NOQUOTES - No quotation marks are decoded.

Additional flags for the document type used:

  • ENT_HTML401 - Default. Process code as HTML 4.01.
  • ENT_HTML5 - Process code as HTML 5.
  • ENT_XML1 - Process code as XML 1.
  • ENT_XHTML - Process code as XHTML.
Similar Functions
Popular Articles