You are here: Re: [PHP] use of curly braces with string interpolation. « PHP « IT news, forums, messages
Re: [PHP] use of curly braces with string interpolation.

Posted by Bret Hughes on 10/03/13 11:05

On Wed, 2005-01-12 at 12:08, Jochem Maas wrote:
> Marek Kilimajer wrote:
> > Jochem Maas wrote:
> >
> >> hi guys,
> >
> >
> >> 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.
> >> 2. it looks nice (easier to read!)
> >>
> >> I have tried to test this with a simple script that does a million
> >> interations - but I cannot get it to return consistent results - one
> >> time with curlies is faster, another its slower.
> >
> >
> > The difference happens at parse time, so if you want to measure any
> > difference execute php script in a loop, not loop inside php script.
> >
>
> DOH! nice one Marek, will make an attempt to 'bash' a script together
> asap (I'm crap at shell scripting! but the challenge is a good one).
> thanks for the heads up.
>
> thinking about what you said, dumping some test code inside an exec()
> call would have the same effect, no?

Try this, put your code in a file, say, testparse.php and
testparsebracket.php
and try something like

myseq=`seq 1 1000`
time for i in $myseq; do php testparse.php;done
time for i in $myseq; do php testparsebracket.php;done

of course the time to spawn php will probably be the most time consuming
part

Bret

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация