The Little Guy Posted October 20, 2012 Share Posted October 20, 2012 When building a class (or any php only file), do you add a closing "?>" or leave it out? Personally I leave it out to avoid "header" errors, but what do you do and what are your thoughts about keeping it or leaving it out? Quote Link to comment Share on other sites More sharing options...
trq Posted October 21, 2012 Share Posted October 21, 2012 I follow the PSR-2 standard, so the closing ?> must be omitted. Quote Link to comment Share on other sites More sharing options...
kicken Posted October 21, 2012 Share Posted October 21, 2012 I leave it out in all my pure php files like class definitions, function libraries, configs, etc. There's no need to have it and I have encountered issues with it being there from other developers adding a bunch of whitespace after the ending ?>. Quote Link to comment Share on other sites More sharing options...
Stefany93 Posted October 29, 2012 Share Posted October 29, 2012 I friend of mine who is a great programmer told me to omit the tag so that I could avoid header errors, also because some text editors have the nasty habit of adding a new line after the closing ?> tag thus screwing up your program. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.