[wp-hackers] Discussion about Optional Closing PHP tags in the WordPress Library

Jason Murray jason at zenphp.com
Wed Jun 18 11:52:39 GMT 2008


On Wed, Jun 18, 2008 at 1:18 AM, Eric Marden <wp at xentek.net> wrote:

>
> Requiring you to leave off the closing ?> is just sloppy. At the very least
> it discourages mindful coding, and being aware of common bugs. Its akin to
> leaving off the semicolon... you're going to get an error.
>
>
I'm going to politely disagree with your comment here, leaving off the ?>
when the file contains only PHP code, or ends in a block of PHP code will
not generate an error.  This is well documented (
http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php)
and actually is recommended use.  Projects such as Zend Framework have
actually made this a part of their coding standards to prevent just these
sort of problems.  It is hardly a sloppy practice, it is simply a different
practice, and one that make sense in the light of this problem.

  -- Jason


More information about the wp-hackers mailing list