Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use logical and descriptive names for your variables. Variables used in iterating loops, such as $i, $j, $k, etc., are exceptions to this rule. Variables should contain only lower-case letters, underscores, and numbers, and should start with a letter. Values true, false, and null should always be lower-case.

Warning
titleIncorrect
Code Block
languagephp
$foo = 365; // not descriptive
$days_in_non_leap_year = 365; // too long
$_year_days = 365; // starts with an underscore

...

Tip
titleCorrect
Code Block
languagephp
define("MY_CONSTANT", "some value");

Keywords

Keywords should always be lower-cased. This is so they do not conflict with constants.

...

Statements

Blesta uses Compact Control Readability style. Each statement should begin on its own line. The exception to this rule is do-while.

...