NYCPHP Meetup

NYPHP.org

[nycphp-talk] single quote vs. double quote

Rolan Yang rolan at omnistep.com
Wed Apr 11 09:52:18 EDT 2007


Tom Melendez wrote:
> 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. :-)
>
I'm thinking that such a php optimizing script would definitely be very 
useful.
It would be beneficial if someone were to write one up and share it with 
the world.


~Rolan



More information about the talk mailing list