Why do some scripts omit the closing PHP tag, '?>'?

Viewed 51140

In some scripts I see that they omit writing a closing tag ?> for the script. Why is it and should I do this as well?

(I'm sure they have not forgotten it.)

7 Answers

Modern versions of PHP set the output_buffering flag in php.ini. If output buffering is enabled, you can set HTTP headers and cookies after outputting HTML, because the returned code is not sent to the browser immediately.

Are the examples still valid in this context?

Related