[nycphp-talk] single quote vs. double quote
Paul M Jones
pmjones88 at gmail.com
Tue Apr 10 12:23:27 EDT 2007
On Apr 10, 2007, at 11:05 AM, Paul M Jones wrote:
> On Apr 10, 2007, at 11:03 AM, Rahmin Pavlovic wrote:
>
>> Does anyone know approximately how much longer double-quotes take
>> to parse
>> in a controlled environment?
>
> My understanding is "little if any"; recent versions of PHP 4 have
> eliminated the time-difference in single/double quote parsing.
In fact, here's a blog entry about it from Sara Golemon:
<http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-
piece-of-string.html>
See comments 4 and 4.1 for the specific answer:
> Definitely a very interesting article.
> It would also be nice to know whether there is a difference between
> single and double quotes because there is always a lot of
> discussion going on about that, too. (and i don't know how to find
> out the opcodes and stuff ;-) )
> #4 Jan on 2006-06-19 10:19 (Reply)
...
> Short version: No. The margin between single and double quoted is
> on the order of nanoseconds. The only thing that gives single-quote
> any kind of edge over double-quote (assuming they're both constant/
> non-interpolated strings) is the fact that double quoted strings
> are subject to more substitution rules (\r\n\t\xFF\012) and so have
> to spend an extra clock-cycle or two on scanning.
>
> Just like so many compile-time bottlenecks though, once you
> introduce an opcode cache, this distinction vanishes.
> #4.1 Sara Golemon on 2006-06-19 11:02 (Reply)
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the talk
mailing list