Re: <<< performance.

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

 



* Rodolfo Gonzalez Gonzalez <rodolfo@xxxxxxxxxxxxxxxxxxxxxxx>:
> this could be a silly question. Is there some performance penalty when 
> using the <<< operator like this:
>
> $var =<<<EOP
> add a bunch of text here
> and here
> EOP;
>
> Just curious.

Try doing some benchmarks using microtime(). My gut reaction is that
there shouldn't be any difference; heredoc syntax is simply another form
of quoting strings.

The other factor to consider is if a few microseconds more of processing
time is worth the extra programming time it takes to get quotes right
(assuming heredoc syntax *does* take longer). I personally prefer
heredocs when using long, multiline strings to using double quotes --
they're easier to maintain.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
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