File Formatting

PHP Tags

PHP code files must not use the PHP short hand notation [”<?”]. The full tag must be used [”<?php”].

To remove the possibility of accidentally injecting a trailing whitespace into the output, the closing tag
(”?>”) must not be used either. The closing tag is not required by PHP.

Add a comment at the last line of the file to indicate the end of the file.

// eof

The output shorthand of ”<?=$var?>” is not allowed either.


Use an indent of four spaces with no tab characters. Editors should be configured to treat tabs as spaces in order to prevent injection of tab characters into the source code. Check your editor for details on how to accomplish this.

Indentation style shall reflect the “Allman Style” of block structure indentation.

Maximum Line Length

The target line length is 78 characters; i.e., developers should aim keep code as close to the 78-column boundary as is practical. However, longer lines are acceptable.

The maximum length of any line of PHP code is 120 characters.

Comment lines may not exceed the 78 character line limit.

Line Termination

Line termination should be in standard Unix text file format. Lines must end only with a linefeed (LF). Linefeeds are represented as ordinal 10, or hexadecimal 0x0A. Do not use carriage returns (CR) like Macintosh computers (0x0D). Do not use the carriage return/linefeed combination (CRLF) as Windows computers (0x0D, 0x0A).

Also, lines should not contain trailing spaces. In order to facilitate this convention, most editors can be configured to strip trailing spaces, and define the RETURN character, to use upon a save operation. Check your editor for details on how to accomplish this.

File Format

All files must be saved in “ISO-8859-1” UNIX format.  This format is understood by all major operating systems. Check your editor for details on how to accomplish this.