NYCPHP Meetup

NYPHP.org

[nycphp-talk] Closing ?> tag

Hans Zaunere zaunere at yahoo.com
Tue May 20 16:10:25 EDT 2003


--- D C Krook <dkrook at hotmail.com> wrote:
> Greetings,
> 
> I noticed at Zeev's demo of the Zend Studio that he tended to leave off the
> 
> end ?> tag when writing up sample code.
> 
> 
> In the phpComponents documentation (http://pcoms.net/submit.php), Hans 
> advises leaving it off:
> 
> "Layout: The first line of pCom source should only contain <?php the full 
> opening PHP tag. Closing PHP tags must not be used...The full opening PHP 
> tag <?php should always be used, where as closing tags should never be 
> used."
> 
> 
> On the other hand, Sterling strongly advises that it not be left off 
> (http://lists.php.net/article.php?group=php.lang&article=403):
> 
> "I definitely think that _you_ should do it."

Well, two against one :)  In the posting above, the poster outlines the exact
reason for not including an ending tag, IMO.  In included files using an end
tag will only bite you in the end, and there is no reason for it; PHP will
drop out of PHP parsing mode at the end of the file anyway.  And:

http://bugs.php.net/bug.php?id=21891

which probably could have been received a little better  :)


> Is there any rationale for leaving it off?  Style?
Yeah, style and debugging.

> Performance?
Maybe a tiny tiny tiny tiny bit.

> Ensuring that you're keeping logic separate from presentation templates?

Yeah, style and debugging.  :)


H





More information about the talk mailing list