Difference between double quotation marks and single quotation marks in php

Source: Internet
Author: User
The difference between double quotes and single quotes in php "" fields in double quotes are interpreted by the compiler and then output as HTML code. ''Is output directly without being interpreted in single quotes. The parsing time of single quotes is faster than that of double quotes. single quotes support \ escape characters, and double quotes support more escape characters. $ hello = 3; echo "hellois $ hello" php double quotes and single quotes are different.

"" Fields in double quotation marks are interpreted by the compiler and then output as HTML code.

''Is output directly without being interpreted in single quotes.

The time for parsing single quotes is faster than that of double quotes.

Single quotation marks support \ escape characters, and double quotation marks support more escape characters

$ Hello = 3; echo "hello is $ hello"; // print the result: hello is 3 echo 'hello is $ hello'; // print the result: hello is $ helloecho "hello is $ hello \ n"; // print the result: hello is 2 (line feed at the same time) echo 'hello is $ hello \ n'; // print the result: hello is $ hello \ n
?

?

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.