Re: Re: use of curly braces with string interpolation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



M. Sokolewicz wrote:
Jochem Maas wrote:


...

I always use curly braces around vars placed in double quoted strings, I do this for 2 reasons:

1. I believe It helps the engine because the var delimitation is explicit, and this means the interpolation is (should be?) faster.

consider that belief destroyed!


it's just as fast as not using it. The delimiter with variables is simply the $[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]* part. Simple variables (scalar) are described using the above, it doesn't make it faster to put more around em. Adding {} around array's/objects shouldn't make it faster, since it's still just taking the entire thing as a variable until it comes acress a character that either delimits the whole thing, or is simply not allowed there.

ok, thanks for the insight!


2. it looks nice (easier to read!)

I think it looks ugly... but it's a simple matter of personal taste ;)

hihi :) (touché)
actually one of the reasons I find it easier to read is that (some of) my texteditor highlight curly-brace-delimited strings. secondly I seem to have trained myself to scan for the curlies.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux