A few simple questions-php Tutorial

Source: Internet
Author: User
Questions for new php users. A few simple questions. 1. what is the difference between single quotes and double quotes in php. 2. php variables & nbsp; $ str & quot; aa $ C & quot; & nbsp; and $ str & quot; aa & quot ;. $ C is not just two different writing methods. ------ solution -------------------- 1. strings in single quotes are not replaced with variables or escaped characters. New php users ask a few simple questions.
1. what is the difference between single quotes and double quotes in php.
2. php variables $ str = "aa $ C" and $ str = "aa". $ C are just two different methods.



------ Solution --------------------
1. Strings in single quotes are not replaced with variables or escaped characters. Double quotation marks replace variables and escape special characters.
2. yes
------ Solution --------------------
Upstairs
Positive solution: Use points to make your program more readable.
------ Solution --------------------
Same as above
------ Solution --------------------
Test it with a program and you will understand everything.
------ Solution --------------------
Variables in double quotation marks are parsed. No single quotation marks (output as is ).
------ Solution --------------------
Learning
------ Solution --------------------
Variables can be placed in double quotation marks, but not in single quotation marks. '$ str' will output $ str. because PHP considers that the single quotation mark is a string rather than a variable.
---------------------------------
In fact, there are only a lot of things in this regard. you enter "What is the difference between single quotes and double quotes" in the google text box in www.google.com, and you will find the answer you need. Thank you!
------ Solution --------------------
Single quotes are highly efficient and support single quotes
------ Solution --------------------
You put the variables in them separately, and then output them.

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.