Closing PHP tag

Dave Hall <[email protected]>
Newsgroups gmane.comp.web.phpgroupware.devel
Organization Dave Hall Consulting
Message-ID <1210481635.7339.115.camel@noby>
Hi all,

I have updated the coding standard to include a new requirement to not
include a closing PHP tag (?>) in script files.

The main reasons for this are:
1 It isn't needed, ?> is only needed when switching out of PHP mode

2 It can introduce whitespace which will introduce output, which may not
be desired

3 Many other projects are taking this approach

Projects which have dropped the closing ?>

 * Zend Framework - http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html#coding-standard.php-file-formatting.general
 * Drupal - http://drupal.org/coding-standards
 * dokuwiki - http://wiki.splitbrain.org/wiki:development#php_closing_tags
 * Joomla - http://docs.joomla.org/Coding_style_and_standards#PHP_Code_Tags
 * postNuke - http://community.postnuke.com/Wiki-CodingStandards.htm 

Those which are silent or against it
 * PEAR (silent) - http://pear.php.net/manual/en/standards.tags.php
 * MediaWiki (silent) - http://www.mediawiki.org/wiki/Manual:Coding_conventions
 * phpBB (silent) - http://area51.phpbb.com/docs/coding-guidelines.html
 * Gallery2 - http://codex.gallery2.org/Gallery2:Coding_Standards#PHP_Code_Tags
 * WordPress - http://codex.wordpress.org/WordPress_Coding_Standards

The PHP manual even recommends dropping them, see
http://php.net/basic-syntax.instruction-separation

I am sure google could have turned up more for either side, but these
were the first 10 FOSS PHP projects that sprang to mind.

As a side note, it looks like most projects are using the PEAR
convention these days.  I personally like the ZF standard, but that is
what I am used to.

I have been dropping them when I am working on a file for some time.  If
there is serious objections I will roll back the changes to the
standard.

 </another_religious_debate>

Cheers

Dave
-- 
LLLLL
L*LLL
LLLLL
LLLLL DAVE
LLLLL HALL
      CONSULTING

      Open Source
      Business Solutions

      p +61 410 47 42 55
      e [email protected]
      w davehall.com.au
      f +61 3 8610 0029
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.