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

From: Date: Wed, 12 Jan 2005 16:40:46 +0000
Subject: Re: Re: use of curly braces with string interpolation.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-206207@lists.php.net to get a copy of this message
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.

« previous php.general (#206207) next »