Our coding standards are based off the PEAR coding standards (CS). Because PHP has a copyright on those standards, they are not printed here however the link will take you to them.
What is presented here is the DIFFERENCES between our standards and the PEAR version. Most of this is due to the unique environment we work in.
Function Calls:
Proper function calls in 3.0.0 require that in the includer you first ensure that the function exists. If the function is not available, you should log the error. Certain Functions are exempt (log and other include.php internal functions.)
example:
if (function_exists('foo')) {
$a = foo();
} else {
log("Error [".date('r')."]: could not initialize function 'foo'\n");
}
Header Comments:
We will maintain our current style header comments. 3.0.0 has some small changes, but nothing drastic. Look at the db_config.php file if in doubt.
Naming Conventions:
Okay, where PEAR says package, we say modules. Keep that in mind and the section makes sense.
Error Handling Guidelines:
We still support PHP 4.x.x Thus this page is useless for us, as we can not use PHP5+ only code. Modules on the other hand may, if they are labeled as being PHP5 or PHP6 ONLY...
Best Practices:
Where you don't need to do formating, it is preferred that you use single quotes. Where formatting is needed (see the function example above), then feel free to use the double quotes.
by growandmake.