News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Should You Close Your PHP Code Tags?
September 20, 2010 @ 13:34:22

On the SitePoint PHP blog there's a new post with an interesting question for PHP developers that might go against how they were tought to code from their early days - should you close your PHP tags at the end of your code?

Even those with a modest grasp of PHP know that code must be enclosed within special tags. [...] However, if your file contains just PHP - and no escaped HTML code - the closing ?> tag is entirely optional. Many developers argue that unnecessary code should be removed but there's another reason you could consider scrapping the closing tag.

Their rationale is that, in some situations, extra characters or other information could pop up after that closing PHP tag and cause problems in your code. If you drop the closing tag completely, there's no risk that this could happen and PHP parses it the same way.

There's lots of great comments with opinions both for and against.

1 comment voice your opinion now!
opinion close tag end error


blog comments powered by Disqus

Similar Posts

Joshua Thijssen's Blog: LAMP-stack? Forget it! Itís a LAMPGMVNMCSTRAH-stack now...

Timothy Boronczyk: PHP Assertions

Reddit.com: Building software from scratch vs learning a framework, before applying to jobs

Freek Lijten's Blog: I was at a conference, you should go too!

Alex Netkachov's Blog: Zend, Prado, ASP.NET. Which framework is the best?


Community Events





Don't see your event here?
Let us know!


community language update symfony package interview tips laravel api install library opinion series release deployment list introduction zendserver podcast framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework