Re: print vs heredoc
| From: | Philip Olson | Date: | Tue, 08 Jul 2003 06:28:18 +0000 |
| Subject: | Re: print vs heredoc | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154310@lists.php.net to get a copy of this message | ||
> As to which is faster is does not really matter as the speed of echo
> print and heredoc is dictated by the connection speed to the
> requesting client. If this is a factor in your overall operation you
> can use output buffering to save the contents and output them at the end of
> your script.
Although really, heredoc can't be compared to either
echo or print, as it's just a string definition that
eventually will be printed. So I guess you guys are
really comparing "" vs heredoc? And I agree that any
speed difference (if there is one) isn't a good reason
to choose when readablity may suffer. So it all
depends on the situation, and the programmer.
> btw what would be nice is a print_raw command that does no
> parsing just sends the stuff :)
> (Would be good for template systems where you know there is no php
> hidden in there.) ... might gain a couple of micro seconds
I believe this is called "breaking out of PHP mode
and into HTML mode", which can be done anywhere, at
any time.
Regards,
Philip