NYCPHP Meetup

NYPHP.org

[nycphp-talk] single quote vs. double quote

Tom Melendez tom at supertom.com
Tue Apr 10 13:06:44 EDT 2007


On 4/10/07, Rolan Yang <rolan at omnistep.com> wrote:
> Hrm.. I just ran a real world test and the results were drastically
> different.
>
> With single quotes, it took about 3.4 seconds to complete.
> With double quotes, 22  seconds on average.
>

I wouldn't have believed it, but I got similar results.  However, it
simply just isn't the presence of the double quotes, but the actual
interpolation taking place in the string.

this:

$test="foostring".$myvar; //double quotes

was just as fast as:

$test='foostring'.$myvar; //single quotes

So, any dreams you may have had of just writing a sed script to
replace all double quotes with single quotes have been crushed. :-)

Tom
http://www.liphp.org



More information about the talk mailing list