Re: <<< performance.
| From: | Matthew Weier O'Phinney | Date: | Tue, 26 Jul 2005 11:51:31 +0000 |
| Subject: | Re: <<< performance. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219343@lists.php.net to get a copy of this message | ||
* Rodolfo Gonzalez Gonzalez <rodolfo@equinoxe.g-networks.net>:
> 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/