Coding Style
Register Globals is Off
- All code must work with PHP register_globals = Off.
- More info: RegisterGlobalsOffCoding?
Single Quotes vs. Double Quotes
- Use single quotes to refer to an index between brackets of an array (ex: $fooname? and not $foo[name] or $fooname?)
- Use single quotes instead of double quotes as much as possible because it's faster to parse.
- You must use " with the gettext() stuff [eg. _("Translatable String")]
Line Spacing
- No tabs, only spaces
- Indent using 2 spaces
SVN Info
- $Id$ Tag inside the heading comment
- Example:
/* $Id$ */
- Example:
Variable Settings
- Paranoid log level safe code.
- Initialize variables. (just $a=0 is initialization)
- Use isset($var)
Echoing HTML
- PHP code should not echo anything.
- PHP code should strictly use templates to generate output.
Code Format
- Inside if, for and while structures, space and {} are mandatory following this example:
foo (whatever) { do something important; }
