For questions about how to use single quotes and double quotes in php, see how to correctly represent strings in PHP: abcdefghijklmnopqrst and abcdefghijklmnopqrst ------ solution ------------------ pairing. you can give an example .. ------ Solution: mixed use of single quotes and double quotes in php
Ask the hero ho
Variables in single quotes are not executed, and double quotes are executed. For example, $ namehello; echothe $ name; will output thehello, and if it is a single quotation mark $ namehello; echothe $ name; will output the main difference of the $ name is this. SyntaxHighlighter. all (); variables in single quotes are not executed, and double
1. Single quotes:What can be said to be WYSIWYG: what you see in a single quote will output what. The contents of the enclosed quotation mark do not occur if the constant or the variable is replaced. 2. double quotes: Output The contents of the double quotation marks, if there are commands, variables, etc., the variables, commands will first parse the results , and then in the output of the final content, the content constant or constant is surroun
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,
If you do not want the following to occur in the PHP page:
Single quotes are escaped AS/'
Double quotes 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/319226.html www.bkjia.com true http://www.bkjia.com/PHPjc/319226.html techarticle in the PHP page, if you do not wa
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
The string data is enclosed in single quotation marks, and the + sign is used to concatenate the strings. Database fields are integral type of time do not add single quotation marks, is a string to add, other types according to the actual situation, the double quotation marks are used to stitch strings, single quotation marks are the inherent wording of SQL, because you want to be dynamic splicing, involving variables, so you want to use "+" to combine each string fragment. The end result is a S
One, single and double-quote escape in PHP data stored in the process used more, that is, to store data in the database need to pay attention to escape single, double quotation marks;Say a few PHP functions first:1. addslashes- uses a backslash reference (escape) string; Returns a string that is preceded by a backslash in order for the database query statement to be preceded by some characters. These characters are single quotes ('), double quotation
(1) Double quotation marks can be used in single quotation marks, the middle will be as a string output (single quotation marks in the characters enclosed in single quotation marks, to be in single quotation marks with the escape character "\", print ' hell\ ' o ')(2) Double quotation marks can be used in single quotes, the middle will be as a string output (double quotation marks in the characters enclosed in double quotation marks, to be in double q
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.