Re: Are '...' faster than "..." in normal code? Single Quot es vs. Double Quotes
| From: | Matthew M. Boulter | Date: | Mon, 04 Dec 2000 23:11:03 +0000 |
| Subject: | Re: Are '...' faster than "..." in normal code? Single Quot es vs. Double Quotes | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28660@lists.php.net to get a copy of this message | ||
> > That goes without saying I think...
>
> Perhaps. Some people may not know about it and is why
> I pointed that fact out.
> It also goes to explain why '' is faster than "".
> :p
>
I wasn't asking or talking about interpolation, mine is a general query:
For all other strings, where I'm NOT doing any interpolation, I'm getting
the impression that ' ' is faster than " ".
Cool, seems logical.
So why doesn't everyone use it? How come everyone's code is scattered with
array indexes as ["baz"] and default values like
var $myProperty = "default_val";
am I being too pedantic by thinking to myself (d'oh have to use a quotation
mark, grrrr) "I'm not doing anything here with the string other than
just wanting it's value, so I'll use single quotes".
Where as those times where I'll interpolate or I want \n, etc correctly used
I'll use "double quotes".
And okay since we're burning lets add some accelerant:
What's better/faster?
$bootType = 'Army'; // or should that be $bootType = "Army" ;)
echo "Yo momma wears $bootType boots";
or
echo 'Yo momma wears '.$bootType.' boots';
or
// this one seems silly
echo "Yo momma wears ".$bootType." boots";
Feel the fires, taste the death. hehehe... 8-)
Matt.