Umi
Umi

Reputation: 108

why module and .install files in drupal don't have closing php tag

If you are creating custom module in drupal no need to end php tag in .module and .install files in drupal.what is the reason we are not closing php tags!

Upvotes: 1

Views: 414

Answers (1)

splatio
splatio

Reputation: 504

From drupal.org/coding-standards:

Note that as of Drupal 4.7, the ?> at the end of code files is purposely omitted. This includes for module and include files. The reasons for this can be summarized as:

  • Removing it eliminates the possibility for unwanted whitespace at the end of files which can cause "header already sent" errors, XHTML/XML validation issues, and other problems.
  • The closing delimiter at the end of a file is optional.
  • PHP.net itself removes the closing delimiter from the end of its files (example: prepend.inc), so this can be seen as a "best practice."

Upvotes: 7

Related Questions