CS:basics

Opening Tags
All code must be opened with full PHP open tags (<?php). Under no circumstances should code be opened with short open tags (<?) or ASP-style tags (<%). This is because the code may be deployed to systems where these options are not enabled, or may coexist with XML documents and/or ASP documents.

Closing Tags
All closing tags should be on a new line, with no other characters. However, there are two exceptions to this rule, as shown in the following examples.

Code on a single line:

Code requiring no spaces or newlines following execution (noting that code and HTML should not be mixed, but used for example purposes):

Appending Code
If you are appending code to a section that has been closed, add your code before the previous code's closing tag. The following is an example of poor coding:

Mixing PHP and HTML
When mixing a PHP block with HTML code, try to avoid excessive opening/closing tags for a improved readability and less parser overload.

e.g. **Bad**

e.g. **Good**