-
Variables can be included in double quotes, where $str reads look at the sea"$str";It will recognize that $str is a variable and explain the contents of the variable to get it"look at the sea", and single quotes'$str'It is to output the string $str, depending on the situation. Sometimes you need to make up a SQL statement with some variables, and double quotation marks are useful.
sql="insert into student(sno,sname,class,password,mark)values(
sno',$name',$stu_class',$password','
This way, you can identify a variable like $sno in double quotes, and you can use single quotes.
-
Variables in double quotes will still be parsed by PHP, and variables in single quotes will be treated as strings. It is best not to use any quotation marks for the output variables, otherwise it will increase the burden on the program.
-
The double quotation marks "" are strings, echo "" is the output string, and echo "$str"; The content of the output string is $str, and the variable without double quotation marks is the value of the output variable.
-
1. When writing a csv file, you need to determine whether there is a comma and double quotation marks and deal with it accordingly.
2. Implement the method of processing when reading CSV files**.
3. Implement the method of dividing data**.
4. Split the data, such as the effect of swimming with shooting.
5. The method of not dividing the comma in double quotation marks, the result of the division is as follows.
-
The district shouts of the two are as follows:
1. The district on the variable is not different.
Double quotation marks can explain variables, but single quotation marks before talking about the first can not explain variables. Single quotes are inserted in double quotes, and if the single quotes contain a variable, the variable is explained.
2. The difference in efficiency.
A single quote mark is more effective than a double question mark because the double quote first needs to be traversed to determine if there is a variable in it, and then the action is performed and there is no need to judge the single quote.
3. Differences in characters.
Double quotation marks explain the escape character, and single quotation marks do not interpret the escape character, but rather an explanation'And.
-
<>2. In , enter **:echo"He said:"I love you! \"
3. The browser runs the empty letter page, and the page can successfully print out double quotation marks by escaping characters.
-
1. When writing a CSV file, you need to first determine whether there are commas and double quotation marks and deal with them accordingly** as follows.
2. Implement the method of processing when reading CSV files**.
3. Implement the method of dividing data**.
4. Segment the data with the following effects.
5. The method of not dividing the comma in double quotation marks, the result of the division is as follows.
-
Use the str replace() function.
Replace the one containing double quotation marks".
Another example you can see at a glance:
This output is hello two
-
$test1 = "php";
1:echo "The most popular technology of the Internet $test1"Output: PHP, the most popular technology of the Internet
2:echo 'The most popular technology of the Internet $test1'Output the most popular technology of the Internet $test1
The above two examples show that the variables in double quotes will be interpreted as variables, and the variables in single quotes will be treated directly as strings, that is, the variables in single quotes will lose their variable properties and become a string.
If you want to use the method of the first sentence to enter the result of the second sentence, add an escape symbol.
3:echo "The most popular technology of the Internet $test1"Output the most popular technology of the Internet $test1
4:echo "The most popular technology of the Internet $test1 technology"Originally, I wanted to output PHP technology, the most popular technology on the Internet, but you found that you can't find the variable $test1 technology, because there is no space, so it treats everything that follows as a variable.
So you will find that many excellent works are recommended''Single-quotes to write variables, unless they are SQL statements. It's to prevent these kinds of mistakes. As for why SQL is excepted, you can figure it out for yourself!
-
"Fields in double quotes are interpreted by the compiler and then output as html.
The single quotation marks are not explained, and are directly output.
The number in php has great features.
-
PHP Quotation Mark Usage Principles:
1.The value of the string is in quotation marks.
Try to use single quotation marks in , and use double quotation marks for all html**.
3.When including variables, double quotation marks can be used to simplify the operation4Complex cases are wrapped in braces.
Another use of php quotes is that sometimes you need to use php to generate text files, and the newline n needs to be used in double quotation marks to make it work, and single quotes will directly output n as characters.
Use summary: You don't need to add variables or single quotes () to the string') and backslashes ( ), try to use single quotes to quote strings, because double quote checks save time on escaping and parsing variables.
You can use single quotation marks as much as possible.
-
Difference Between PHP Single and Double Quotes:
The content of a double-quote string can be interpreted and replaced, while the content of a single-quote string is always considered a normal character.
For example: $foo = 2; echo "foo is $foo";Print result: foo is 2 echo'foo is $foo';Print Result:
foo is $foo echo "foo is $foo";Print result: foo is 2 (simultaneous line wrap) echo'foo is $foo';Print result: foo is $foo $foo = 2; echo "foo is $foo";Print Result:
foo is 2 echo 'foo is $foo';Print result: foo is $foo echo"foo is $foo";Print result: foo is 2 (simultaneous line wrap) echo'foo is $foo';Print Result:
foo is $foo
In a string of single quotes, even a backslash loses its extended meaning (except for inserting a backslash and inserting a single quote')。So, when you want to do variable substitution and include escape sequences such as (line breaks) in a string, you should use double quotes. Single-quote strings can be used anywhere else, and it's faster to use single-quote strings in scripts.
You put $mysql=mysql query("select * from user where name='$name'");Change to $mysql=mysql query("select * from user where name='”.$name."'");Then print it in the update file to see if there is a value. >>>More
In fact, there are a lot of integrated installation packages that can put everything in place for you at once, but it is not recommended to do that. >>>More
Error file, basically useless, so don't open it.
Write by yourself You can create different tables in the database.
function assoc_unique($arr, $key) {
tmp_arr = array(); >>>More