Single quotes, double quotes, and Heredoc initialize the difference between PHP strings

Source: Internet
Author: User

The string in PHP refers to the sequence of characters, which can be initialized in three ways: single quotes, double quotes, and use of Here Document (Heredoc).

One: when single quotation marks

①: Special characters that need to be escaped: backslashes and single quotes.

②: Because PHP does not check for insert variables and any escape sequences in single-quote strings, the single-quote string is intuitive and fast.

Common escape sequences:

Two: double quotes

①: Single quotes that recognize double-quoted strings and do not need to be escaped

②: Ability to identify inserted faces and escape sequences in a table

Single quotes, double quotes, and Heredoc initialize the difference between PHP strings

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.