CodeIgniter Forums
Hello World controller example - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Hello World controller example (/showthread.php?tid=61841)



Hello World controller example - cupboy - 05-23-2015

I was looking at the Hello World example in the documentation and see there is no ?> at the end. Why would that be?

http://www.codeigniter.com/user_guide/general/controllers.html?highlight=controller#let-s-try-it-hello-world


RE: Hello World controller example - CroNiX - 05-23-2015

That's very common to leave off the ending php closing tag. If there is any whitespace after the closing tags it can cause errors, so it's generally best just to leave it off. PHP doesn't require it, and there really isn't any benefit to having it. Most modern php code leaves it off, not just CI.

http://stackoverflow.com/questions/3219383/why-do-some-scripts-omit-the-closing-php-tag


RE: Hello World controller example - cupboy - 05-23-2015

Interesting. I guess I will have to remove those closing tags now.


RE: Hello World controller example - madaan_tushar - 05-25-2015

It is becoming very common practice for the web-atisans to leave closing the PHp tags to avoid some errors. Why you have a probz regarding that, its good naa to code less.
Since, CI is for developers to code less/small footprint


RE: Hello World controller example - ardavan - 05-25-2015

(05-23-2015, 05:25 PM)CroNiX Wrote: That's very common to leave off the ending php closing tag. If there is any whitespace after the closing tags it can cause errors, so it's generally best just to leave it off. PHP doesn't require it, and there really isn't any benefit to having it. Most modern php code leaves it off, not just CI.

http://stackoverflow.com/questions/3219383/why-do-some-scripts-omit-the-closing-php-tag

Correct, Also its more secure