- Use an indent of 4 spaces, with no tabs
- Line length of 75-85 characters
- Control statements should have one space between the control keyword and opening parenthesis.
- Example: if (condition) {
- Split long if statements onto several lines
- Indent 4 characters
- Logical operators at beginning of line
- Closing parenthese and opening brace on own line
- Example:
if (condition1
|| condition2
&& condition3
) {
// code
}
- Example:
$a = $b
? $c
: $d;