Re: print vs heredoc
| From: | Joel Rees | Date: | Tue, 08 Jul 2003 02:54:01 +0000 |
| Subject: | Re: print vs heredoc | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-154302@lists.php.net to get a copy of this message | ||
> Hi, again!!
I thought I saw this post once already.
> I'm looking for opinions as to which is better/faster, print or heredoc.
Well, like the guy said before, it sounds like you've
pretty much already made up your mind.
I don't use heredocs everywhere, but when I have a fairly large block of
html with a small number of straight variable substitutions (no
conditionals, etc.), I sometimes find heredocs to be convenient, and a
lot easier to read in the source.
<reformatted style="wrapped">
> print makes the code layout look nice
Well, one of the purposes of a heredoc is to get the code out of the
content, yielding a cleaner, more readable layout. If that's not what
you're getting, you probably don't want to use heredocs.
> and eazy to debug,
If there's something you need to debug, heredocs are possibly not
indicated.
> where heredoc
> IS faster but makes the code look like a nightmare with everything
> jammed against the left side of the code.
Not sure what you're saying. When I use heredocs, that is not the result,
by any stretch of the imagination. (Well, I'm not sure about the speed
business.)
> I'm pretty picky about what looks good and heredoc is a nightmare of
> horrors...
</reformatted>
If that's the results you're getting, I'd say heredoc is probably not
appropriate for what you're trying to do.
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp