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? Link to comment https://forums.phpfreaks.com/topic/269728-closing/ 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. Link to comment https://forums.phpfreaks.com/topic/269728-closing/#findComment-1386676 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 ?>. Link to comment https://forums.phpfreaks.com/topic/269728-closing/#findComment-1386677 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. Link to comment https://forums.phpfreaks.com/topic/269728-closing/#findComment-1388530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.