I typically work individually or in a group of two on development projects. There are always differences in standards followed by programmers. There are endless debates on the intertubes on this subject. This post is not to sway anyone one way or the other. I have spent some time looking into two common recommendatiosn for coding standards, the PEAR and Zend coding standards.
Why with an if is the '{' on the declaration line and with a class or method the '{' goes after the return? My goal is to follow the coding standards on future projects to create a standard.
Upon quick review I do follow 90% of the coding standards, as do most of the programmers I work with. The one that will take sometime to digest is:
if ($a != 2) {
$a = 2;
} elseif ($a == 3) {
$a = 4;
} else {
$a = 7;
}
and
class Foo
{
/**
* WRONG
*/
public function bar()
{
return($this->bar);
}
/**
* RIGHT
*/
public function bar()
{
return $this->bar;
}
}
Why with an if is the '{' on the declaration line and with a class or method the '{' goes after the return? My goal is to follow the coding standards on future projects to create a standard.
No comments:
Post a Comment