Usage analysis of PHP double quotes and single quotes

Source: Internet
Author: User
Usage analysis of PHP double quotes and single quotes
In this article, I have encountered a problem of double quotation marks and single quotation marks in php in my actual work, with a solution attached. if you have any need, you can make a reference. Use PHP to filter line breaks in a string. this operation is usually performed as follows:
     PHP provides three methods for defining strings: single quotes, double quotation marks, and local documents (here document or heredoc ). Single quotes: using single quotes is the most efficient method, because PHP does not check the built-in variables and escape sequences in single quotes. only the backslash and single quotes must be escaped. Double quotation marks: the built-in variables and escape sequences are checked, but the escape single quotation marks cannot be recognized. This also shows the error of the code. the correct method is to use double quotation marks to define the escape sequence of line breaks:
      Check all built-in variables and escape sequences. double quotation marks do not need to be escaped. For example:
       

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.