Welcome to the Linux community forum and interact with 2 million technical staff to enter 1.php? $ Str frozen fish; echo $ str's blog address is www.xker.com; note that this is a single quotation mark. 2.php? $ Str frozen fish; echo $ str's blog address is www.xker.com; note that this is a double quotation mark, $ str
Welcome to the Linux community forum and interact with 2 million technical staff> enter 1.php? $ Str = 'frozen fish '; echo' $ str's blog address is http://www.xker.com '; // note that this is a single quotation mark. 2.php? $ Str = 'frozen fish '; echo "$ str's blog address is http://www.xker.com"; // note that this is a double quotation mark, $ str
Welcome to the Linux community forum and interact with 2 million technicians>
1. php
Echo '$ str's blog address is http://www.xker.com'; // note that this is a single quotation mark.
.>
2. php
$ Str = 'frozen fish ';
Echo "$ str's blog address is a http://www.xker.com"; // note that this is a double quotation mark, $ str has a space
.>
3. php
$ Str = 'frozen fish ';
Echo $ str. 'The blog address is http://www.xker.com'; // there is no impact on the single-double cited, it is said that the single cited speed is fast
.>
You can see the result 1. php shows the content in single quotes, and does not replace $ str with "frozen fish", that is, display "$ str blog address is http://www.xker.com" and 2. php and 3. php has changed $ str to "frozen fish", that is, the display is "frozen fish blog address is http://www.xker.com ",
In this way, the difference is obvious. Single quotes also treat the variable names as strings. Double quotation marks will automatically search for and replace the variable names. Note that if the variable name is followed by a common character (excluding punctuation marks, such as commas ), you must add a space after the variable name. Without the program, you cannot determine where your variable name ends.
Comparing php and 3.php, we can find that the double quotation marks can save a lot of effort when adding strings. We recommend that you use single quotes when no variables are needed. It is said that the speed is fast and I don't feel it.