PHP htmlspecialchars_decode () instance tutorial

Source: Internet
Author: User

PHP htmlspecialchars_decode () instance tutorial

Definition and usage
The htmlspecialchars_decode () function converts some predefined HTML entity characters.

The HTML object is decoded as follows:

& Become & (symbol)
"To" (double quotation marks)
'To' (single quotes)
"Become" (less)
"Become" (greater)
The htmlspecialchars_decode () function is the opposite htmlspecialchars ().

Syntax

Htmlspecialchars_decode (string, quotestyle)

Parameter description
String required. Decodes the specified string.
Quotestyle is optional. Specifies how to decode a single, double quotation marks.
The following quote methods are available:

ENT_COMPAT-default. Double quotation marks
ENT_QUOTES-double and single quotes
ENT_NOQUOTES-no quote decoding
 


--------------------------------------------------------------------------------

Example 1

<? Php $ str = "Jane & amp; & #039; Tarzan & #039;"; echo htmlspecialchars_decode ($ str); echo "<br/> "; echo htmlspecialchars_decode ($ str, ENT_QUOTES); echo "<br/>"; echo htmlspecialchars_decode ($ str, ENT_NOQUOTES);?>

Jane & 'tarzance' Jane & 'tarzanc'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.