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
$id = ' 0 ';$arr =array (' a.jpg ', ' b.jpg ', ' c.jpg ');echo "' {$arr [$id]} ';Echo ' Echo ' {$arr [$id]} "';Out' C.jpg '"{$arr [$id]}"ReasonThe fields inside the double quotation mark are interpreted by the compiler and then output as HTML code.' No explanations in single quotes, direct output1. The value of the string is enclosed in quotation marksUse single quotes as much as possible in 2.PHP, with dou
Differences between single quotes and double quotes-Linux general technology-Linux technology and application information. Variables can be referenced in double quotation marks, which can be omitted simply.
The $ symbol in single quotes is used by common characters.
A = B
Echo "$"
B
Echo '$'
$
One problem is whether to use single or double
In JavaScript, improper use of single quotes and double quotes may result in js Code conflicts and JavaScript cannot run correctly. It is easy to resolve the conflict between single quotes and double quotes in JavaScript, we only need to use single-and-double-mixing, and we can escape all.
To solve the single-cited and
: This article mainly introduces the difference between single quotes and double quotes in PHP. if you are interested in the PHP Tutorial, please refer to it. In PHP, you can use single or double quotation marks to define a string. In normal use, there is no difference between the two symbol-defined strings. Today, I wrote several lines of code as an example to illustrate "assignment by address assignment,
Whether you are writing JavaScript or PHP, you are always accustomed to using single quotes. But the weekend at home coding encounter a problem, you need to filter the string by PHP line breaks, follow the following method:
$out = str_replace (Array (' \ r \ n ', ' \ R ', ' \ n '), ', $out); PHP provides three ways to define strings: single quotes, double quotes,
When you use Word to create a document, you find that you enter straight quotes, but they are replaced with curly quotes.
Entering straight quotes in half-width states is replaced with curly quotes, which turns on a replacement feature in Word. If you do not need to, you can turn off the following settings.
1. Select
Double quotes will let the program be checked for variables that are not
When you use a variable, you can compile it with double quotes before you can replace it with a variable value.
There are also n and so to be double quotes, with single quotes directly output n
and single
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
Punctuation marks in programming languages are not something we can add to others and know what you want to say, but computers are different. Improper use may cause errors and cause a lot of trouble to you, the use of single and double quotes in PHP is a common problem for beginners... syntaxHighlighter. all ();
Punctuation marks in programming languages are not something we can add to others and know what you want to say, but computers are different.
1. Single quotes ('')
# Grep Susan phonebookSusan Goldberg 403-212-4921Susan Topple 212-234-2343If we want to search for Susan Goldberg, we cannot directly use the grep Susan Goldberg phonebook command. grep regards Goldberg and phonebook as files to be searched.# Grep 'Susan gold' phonebookSusan Goldberg 403-212-4921When the shell encounters the first single quotation mark, it ignores all the special characters that follow it until the right quotat
Single and double quotes are roughly the same, but one thing is very important, is the variable reference problem, you run the following code to understand
The code is as follows
Copy Code
$x = "China";echo "I am $x person";//double quotesecho "Echo ' I am $x person ';//single quote?>
Variables are enclosed in double quotes, but not in single
Single quotes: What you see is what you get: The contents of the single quotation mark are output as-is, or what you see in single quotes is what you output. Double quotes: Output The contents of the double quotation marks: If there are commands, variables, etc. in the content, the variables, commands are parsed out and then the final content is output. the comm
MySQL query with quotes and no quotes difference
When the database field ID is an integral type
Select ID from table where id=1
And
Select ID from table where id= ' 1 '
Two SQL is OK, but the first SQL does not have to be implicitly converted, slightly faster than the second SQL
Today, when inserting a single quote string into a MySQL database, nothing is reported as a statement execution failure, and the
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. The single quotation mark ' is a full reference, and the contents of the enclosed quotation mark do not occur if the constant or the variable is substituted.Double quotes:The contents of the double quotation marks are output, and if there are commands, variables, etc., the variab
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
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.