21Dec/102

PHP Closing tag ?>

Sometime ago I saw some framework where all files missed PHP closing tags, I wondered why ? Simply, this tag is not required by PHP parser, interesting when this was introduced. But one advantage of this is elimination of hunting down final carriage return character in the end file. This additional CR mess up the output when including.

In projects with 200+ code files, one simple return at the end of file can cause bugs hard to find.

UPD: My discovery is clearly described in documentation :) http://php.net/manual/en/language.basic-syntax.instruction-separation.php

Did you find this post useful? Support the the author ($10)
My Google Profile+
Comments (2) Trackbacks (0)
  1. It is explained clearly the optional nature of the file ending ?> in the php manual

    http://php.net/manual/en/language.basic-syntax.instruction-separation.php

  2. Cool ) Completely missed this point and documentation gives exactly same hint as I did. Interesting was it in PHP with every beginning ? like version 3 or 4.


Leave a comment

No trackbacks yet.