Brief summary:
Single quotes:What you can say is what you see is what you get: the contents of a single quotation mark are output as-is, or what you see in single quotes is what you output. double quotes:The contents of the double quotation marks are output, and if there are commands, variables, etc., the variables, commands are parsed out and then the final content is output. No quotes:does not consider the string containing the space as a whole
Look at a PHP blog today and note that: "The index key value in PHP, if not enclosed in quotes, interprets the index key value as a constant, which is interpreted as a string when no definition of the constant is found." I'm a little bit convinced because I always enclose the index key in quotes, so this doesn't happen. Take the time to write a line of code to test it:
Copy Code code as follows:
De
Student Summary (II) -- what are the single quotes in students and what are the student quotes?
Student Summary (II)-What are the single quotes in students?
If you see this question, you may think that I am selling it. Let's take a look at this summary! Recently, I encountered a bottleneck in coding and asked a lot about
The single
The punctuation in programming language is not as we speak can be casually add others also know what you want to say, but the computer is not the same, the use of improper will cause errors will cause you very annoying, PHP single and double quotation marks are frequently encountered by novice users of the problem, this article explains the difference between the two, I hope to help the novice!
In PHP, typically a string is defined in a pair of quotation marks, such as:
' I am a string in singl
The test table I set up is like this:
The code is as follows
Copy Code
CREATE TABLE ' foo ' (' Key ' VARCHAR not NULL,' Time ' INT (one) is not NULL,PRIMARY key (' key ')) Engine=myisam DEFAULT Charset=utf8;
Then insert the 30多万条 data, and then execute the following SQL statement:
The code is as follows
Copy Code
SELECT *From ' foo 'WHERE ' key ' =1293322797
The query takes 0.1288 seconds, takes about a long time, and
Many programmers think that in PHP, single and double quotes are the same, in fact, it depends on how to use, in some ways they are the same, but there are some aspects of them are very different, today's small series to tell you what the difference.
1, in general, the two are general. But if the double quotes are written inside the variable, the parse operation is performed, and the single quote does not
Anti-quotes, usually below the ESC key.It is a symbol that is introduced to differentiate between MySQL's reserved words and ordinary characters.For example: Select ' Select ' From ' Test ' WHERE select= ' field value 'In the test table, there is a select field, without the use of anti-quotes, MySQL will treat select as a reserved word resulting in an error, so there is a MySQL reserved word as a field, you
In PHP programming, the double quotation mark "and the single quotation mark" is the string and the character expression form, then we want to output it how to do, below we see a simple output single double quotation mark instance bar.
Home we look at several ways to output double quotes
Method one.
Copy CodeThe code is as follows:
$str = ' I want to output double quotes ';
Echo $str;
The result is: I w
I thought that the difference between single quotes in PHP is so simple and the basic knowledge should be that every phper knows the difference, and there are still a lot of phper does not know, which is also very painful and painstaking, so, the difference between single quotes and double quotes in PHP is actually very simple. When PHP parses double quotation m
Of course, through the selection of double quotes, and then modify the font for the song Body (Chinese text) to solve, but this will always bring some trouble to the work, but also easy to forget to modify, the following article on the Word2013 input Chinese double quotes automatically replace the double quotes in two ways.
Word double quotation mark substitut
Town Field Poem:The Pure Heart sentiment wisdom language, does not have the world name and the benefit. Learn water under the hundred rivers, give up arrogant slow meaning.Learn to have a small return to feed root, willing to cast a conscience blog. Sincere in this writing experience, willing to see the text to inspire.——————————————————————————————————————————Code1 DOCTYPE HTML>2 HTML>3 Head>4 Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"/>5 title>title>6 Scriptt
In the PHP page, if you do not want the following conditions:
Single quotes are escaped as '
The double quotation marks are escaped as "
You can then set the following to prevent:
Method One: Set in php.ini: MAGIC_QUOTES_GPC = Off
Method Two: $str =stripcslashes ($STR)
http://www.bkjia.com/PHPjc/629793.html www.bkjia.com true http://www.bkjia.com/PHPjc/629793.html techarticle in the PHP page, if you do not want the following situation: s
PHP in the previous cognition, the single quotation mark and double quotation marks are not different, if the outside use of single quotation marks, then the inside is double quotation marks, if the outside using double quotation marks, inside the use of single quotation marks, always thought that single quotes, double quotes is the difference, but there is a little difference.
The difference is that the
For questions about how to use single quotation marks and double quotation marks in php, see how to correctly represent strings in PHP: "abc 'defg" hijklmn "opq 'rst" and the string 'ABC "defg 'hijklmn 'opq" rst'. you can use the pairing method as an example .., $ X = mixed use of single quotes and double quotes in php
Ask the hero how to correctly represent the string in PHP: "abc 'defg" hijklmn "opq 'rst
ASP | HTML] single quotes and double quotes
Errors in javascript:
① Error:Quote: ② Correct:Quote: Note: You can see that in this example, the attribute is set with double quotation marks, and the double quotation marks contained in ① are naturally wrong! Change the incorrect double quotation marks to single quotation marks in view ②! Now.
Errors in ASP (VBScript:
① Error:Quote: Response. Write ("%>
② Correc
1. Variable expressions can be parsed in double quotes, but not in single quotes.
2. Double quotation marks will parse escape characters such as line breaks, but single quotation marks cannot
1PHP2$ Name= "Jack";3Echo'$ Namejones, you are a good \ t \ tguy ;4Echo"{$ Name} Jones, you are a good \ t \ tguy";5?>
Page output
$ Namejones, you are a good \ t \ tguyJackjones, you are a good guy
Here we c
I have always thought that the use of single quotes and double quotes in PHP is not much different, but today I am doing an example to find that there are actually some differences.
CodeI:
$ Tempfilename=Tempnam('D:/tmp/', 'Data -');Echo'Temporary data will be stored in$ Tempfilename';
Run the above Code to output the original content in the quotation marks. $ tempfilename is not treated as a variable;
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.