You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

General

  • Use the most compact notation that is still easy to understand.

Brackets and Indentation

  • Use two (2) spaces for indentation.
  • No tabs, only spaces.
  • Curly brackets on new line:
if($a > 0)
{
  $foo = bar;
}
else
{
  $foo = fum;
}
  • Curly brackets may be omitted only when they may be omitted from the entire clause:
OK:

if($a > 0)
  return(true);
elseif($b > 0)
  return(false);

Not OK:

if($a > 0)
{
  $a++;
  $foo = bar;
}
else
  return(false);

Variables

  • Camel case with lower initial:
    $cou = 'whatever';
    $couAllowed = array();
    $isInCou = false;
    
  • Avoid very short names except in very compact contexts.

Methods

  • Camel case with lower initial:
    $this->bindModel();
    $this->initializeParentCou();
    
  • No labels