NYCPHP Meetup

NYPHP.org

[nycphp-talk] Closing Tags or Not Closing Tags, that is my question...

Brent Baisley brenttech at gmail.com
Tue Dec 18 11:33:48 EST 2007


I remember reading that and it immediately seemed like a great idea.  
How many times have you tried a redirect or set a cookie, only to get  
the error "Headers already sent". That extra return after the  
closing ?> causes the headers to be sent, since you are delivering  
content. You also avoid extra characters being sent.
Did you ever look at the source code of a web site and see dozens (or  
more) of blank lines together? Anything after the closing ?> gets  
sent to the client, even if it's just a bunch of extra returns.

I can't think of a good reason to include the closing ?> if you don't  
specifically need it.

Brent

On Dec 17, 2007, at 9:09 PM, mikesz at qualityadvantages.com wrote:

> Hello and Greetings To All,
>
> "The closing PHP tag isn't required and actually stops people breaking
> things. We removed it intentionally, since some customers were adding
> whitespace to the end and getting blank pages / cookie errors."
>
> This was posted by a senior developer for a VERY popular PHP product.
>
> Any body care to comment on this, I am a little disturbed about where
> it came from having had the white space after the tag problem on more
> than one of the products I have had the joy to troubleshoot... but I
> don't think dropping the closing tag was ever a solution that I
> entertained. I just think its a poor and sloppy approach to problem
> solving. Any comments?
>
>
> -- 
> Best regards,
>  mikesz                          mailto:mikesz at qualityadvantages.com
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list