On Tue, Apr 13, 2010 at 9:13 AM, Nathan Rice <[email protected]> wrote:
> the closing ?> tag at the end of a PHP file isn't necessary.

Yes, it is best to leave it out UNLESS it causes bug reports.

However, people new to PHP often assume that PHP tags must be
balanced. Instead of verifying their assumption they call attention to
the "issue". This is understandable (we've all been there) so I have
another solution:

You can add a comment to the end of the file:

/* PHP does not require a closing tag (?>) at the end of a
script. Actually it's safer this way, as you are less likely to
break your site. You see, blank lines after the closing tag
cause PHP to send the headers. It has to send them before
the first byte of the response can be sent. Later, WordPress
tries to send headers and PHP throws a warning. So the
omitted "?>" is not a bug; don't email anybody about it.
However, it is necessary to close this comment to avoid an
even worse error so we'll do that now. */

Andy
_______________________________________________
wp-testers mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-testers

Reply via email to