1.2.150. Close Tags Consistency

PHP scripts may omit the final closing tag.

This is a convention, used to avoid the infamous ‘headers already sent’ error message, that appears when a script with extra invisible spaces is included before actually emitting the headers.

The PHP manual recommends : “If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file.”. (See PHP Tags):

.. code-block:: php

   <?php

   class foo {

   }

1.2.150.1. Specs

Short name

Php/CloseTagsConsistency

Rulesets

All, Changed Behavior, Preferences

Exakat since

0.9.3

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

close-tag

Available in

Entreprise Edition, Exakat Cloud