[drupal-devel] no ?> needed at the end of modules

Gabor Hojtsy gabor at hojtsy.hu
Sun Aug 21 18:15:02 UTC 2005

>>Here is the quote for those who did not click through
>>+ Note:  The closing tag of a PHP block at the end of a file is
>>optional, and in some cases + not using it is helpful when using
>>output buffering and include() or require().
> Can someone explain how it's helpful with output buffering and include()?  
> Since with output buffering headers aren't sent until later anyway, it should 
> make extra whitespace irrelevant, and therefore negate the need to leave off 
> the ?> in order to permit sloppy whitespacing.

It is probably badly worded. It is generally helpful if you do

 - include(), require() *without* output buffering
 - anything *with* output buffering, not generating XML/SGML output

Note that although HTML and XML is permissive on the whitespace you
output, if you do generate some other format (ie. csv file, image, swf
file) with output buffering, and store the results elsewhere, additional
whitespace in unintentional places can be a big pain. It is actually
irrelevant if you use output buffering or not.


More information about the drupal-devel mailing list