Developer's Guide
Variable names
1. Corresponding to data from databases: $my_var
2. Corresponding to algorithm: $my_var
3. The visibility of a member variable does not affect its name: private
$my_var
Assignments
1. There should be a space between variable and operators:
2.
3. $my_var = 17;
4. $a = $b;
Operators
1. "+", "-", "*", "/", "=" and any combination of them (e.g. "/=") need
a space between
left and right members
2.
3. $a + 17;
4. $result = $b / 2;
5. $i += 34;
6. "." don't have space between left and right members
7.
8. echo $a.$b;
9. $c = $d.$this->foo();
Recommendation
For performance reasons, please don't abusing of use of
concatenation.
10. ".=" need a space between left and right members
11.
12. $a .= 'Debug';
Statements
1. if, elseif, while, for: presence of a space between the if keyword and
the bracket
2.
3. if (<condition>)
4. while (<condition>)
5. When a combination of if and else are used and that they should
both return a value, the else has to be avoided.
6.
7. if (<condition>)
8. return false;
9. return true;
Recommendation
We recommend one return per method / function