单引号和双引号标记为字符串分隔符 [英] Single versus Double quote marks as string delimiters
问题描述
大家好,
我听过其他人说PHP可以更快地解析双引号字符串
(例如Hello,World)它可以解析单引号字符串(例如,
''Hello,World'')。这似乎是向后退的,因为必须检查需要解释的任何变量的双引号字符串
,而
单引号字符串不会。
那么,这个问题的真相是什么?和解释?感谢任何
信息!
-Josh
Hi All,
I have heard other people say that PHP can parse double quoted strings
(e.g., "Hello, World") faster than it can parse single quoted strings (e.g.,
''Hello, World''). This seems backwards to me, since double quote strings
have to be checked for any variables that need to be interpreted, whereas
single quoted strings do not.
So, what is the truth on this matter? And the explanation? Thanks for any
information!
-Josh
推荐答案
Joshua Beall :
Joshua Beall:
大家好,
我听过其他人说PHP可以解析双引号的字符串
(例如,Hello,World和)比解析单引号字符串更快(例如,
''Hello,World'')。这对我来说似乎是倒退,因为必须检查双引号字符串是否需要解释任何变量,而
单引号字符串则不会。
那么,什么是关于这个问题的真相?和解释?感谢
任何信息!
Hi All,
I have heard other people say that PHP can parse double quoted strings
(e.g., "Hello, World") faster than it can parse single quoted strings
(e.g.,
''Hello, World''). This seems backwards to me, since double quote strings
have to be checked for any variables that need to be interpreted, whereas
single quoted strings do not.
So, what is the truth on this matter? And the explanation? Thanks for
any information!
事实如你所想,双引号字符串需要更多工作。但
的差异绝对可以忽略不计。我使用单引号或双引号
,具体取决于文本的性质,如果它包含许多双引号,
就像HTML一样,我更喜欢单引号。
$ b $bAndréN?ss
The truth is as you think, double quoted strings require more work. But the
difference is absolutely negligible. I use single or double quotes
depending on the nature of the text, if it contains many double quotes,
like HTML often does, I prefer single quotes.
André N?ss
Joshua Beall< jb **** @ donotspam.remove.me.heraldic.us>写道:
Joshua Beall <jb****@donotspam.remove.me.heraldic.us> wrote:
我听过其他人说PHP可以解析双引号字符串
(例如,Hello,World)比解析单引号字符串更快(/例如,''你好,世界'')。这对我来说似乎是倒退的,因为必须检查需要解释的任何变量的双引号字符串,而单引号字符串则不会。
I have heard other people say that PHP can parse double quoted strings
(e.g., "Hello, World") faster than it can parse single quoted strings
(e.g., ''Hello, World''). This seems backwards to me, since double
quote strings have to be checked for any variables that need to be
interpreted, whereas single quoted strings do not.
http://www.phpfreaks.com/forums/inde。 ..howtopic = 13321 (一个可靠的
来源)说单引号是优先的。
-
Michael Wilcox
mjwilco at yahoo dot com
Web开发人员的基本工具 - http://mikewilcox.t35.com
http://www.phpfreaks.com/forums/inde...howtopic=13321 (a reliable
source) says that single quotes are prefereable.
--
Michael Wilcox
mjwilco at yahoo dot com
Essential Tools for the Web Developer - http://mikewilcox.t35.com
2004-01-24,Joshua Beall< jb **** @ donotspam。 remove.me.heraldic.us>写道:
On 2004-01-24, Joshua Beall <jb****@donotspam.remove.me.heraldic.us> wrote:
大家好,
我听过其他人说PHP可以解析双引号字符串
(例如,Hello,World)比它可以解析单引号字符串(例如,'Hello,World'')。这对我来说似乎是倒退,因为必须检查双引号字符串是否需要解释任何变量,而
单引号字符串则不会。
那么,什么是关于这个问题的真相?和解释?感谢任何
信息!
Hi All,
I have heard other people say that PHP can parse double quoted strings
(e.g., "Hello, World") faster than it can parse single quoted strings (e.g.,
''Hello, World''). This seems backwards to me, since double quote strings
have to be checked for any variables that need to be interpreted, whereas
single quoted strings do not.
So, what is the truth on this matter? And the explanation? Thanks for any
information!
Imho只有一种方法可以找到答案。实验。
doublequotestime = 0;
singlequotestime = 0;
10000次
获取时间戳
为1000000000次
echo" hello world"
get timestamp2
doublequotestime + =(timestamp2 - timestamp)
获取时间戳
为1000000000次
echo''hello world''
get timestamp2
singlequotestime + =(timestamp2 - timestamp)
echo doublequotestime;
echo singlequotestime;
-
http:// home .mysth.be / ~timvw
这篇关于单引号和双引号标记为字符串分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!