Updated the standard a little

This commit is contained in:
jengo 2001-05-19 03:59:04 +00:00
parent 6b3a39b639
commit a1491eda4a

View File

@ -11,33 +11,40 @@ It should look like this:
6) Do not document every bit of code in comments. PHP is an interpreted language and it will be nasty on performance 6) Do not document every bit of code in comments. PHP is an interpreted language and it will be nasty on performance
7) Use switch statements where many elseif's are going to be used. Switch is faster and I like it better! 7) Use switch statements where many elseif's are going to be used. Switch is faster and I like it better!
8) If statement formats 8) If statement need to follow the following format
Choice 1:
if ($var == 'example'){
echo 'This is only an example';
}else{
echo 'This is not a test. This is the real thing';
}
Choice 2: if ($var == 'example')
if ($var == 'example'){ echo 'An example'; } {
echo 'This is only an example';
}
else
{
echo 'This is not a test. This is the real thing';
}
Do NOT make if statements like this
if ($var == 'example'){ echo 'An example'; }
(I prefer that choice 2 should not be used when there is an else involved.)
All other styles are not to be used. This is it. Use it or I will personally come and nag you to death. All other styles are not to be used. This is it. Use it or I will personally come and nag you to death.
9) class/function format 9) class/function format
class testing class testing
{ {
function print_to_screen() { function print_to_screen()
global phpgw, phpgw_info; {
if ($var == 'example'){ global phpgw, phpgw_info;
echo 'This is only an example';
}else{ if ($var == 'example')
echo 'This is not a test. This is the real thing'; {
echo 'This is only an example';
}
else
{
echo 'This is not a test. This is the real thing';
}
} }
} }
}
Notice that when defining a class we break from the norm (putting } on same line as statement) and move the { to the next line. Dont ask me why, but this is what I/we do. Notice that when defining a class we break from the norm (putting } on same line as statement) and move the { to the next line. Dont ask me why, but this is what I/we do.