For one person's hypothetical opinion on a less-trivial aspect of coding practice (to see the sort of things that probably ought to be discussed, and one side of such a discussion):
When it comes to coding differences, such as
while($row=mysql_fetch_array($resultset))
{ //...
}
vs.
$numrows=mysql_num_rows($resultset);
if($numrows!=0)
{ for($i=0; $i<$numrows; ++$i)
{ $row=mysql_fetch_array($resultset);
//...
}
}
there might be reasons why a programmer might prefer one idiom over the other. I've never seen much of an explanation for the first, beyond the fact that it's used in the PHP manual examples. I often use the second because it gives me a hook on which to hang something if the resultset turns out to be empty; and because I'm usually interested in knowing how many results there are anyway - the former provides explicitly neither that nor the current row index. I could go:
$i=0;
while($row=mysql_fetch_array($resultset))
{ //...
$i++;
}
$numrows=$i;
But I have some objection to scattering bits of my loop control across half the script. Besides, the above snippet is exactly equivalent to:
for($i=0; $row=mysql_fetch_array($resultset); ++$i)
{ //...
}
$numrows=$i;
And the fact that the loop index is used after the loop has ended is something I'm not personally keen on, preferring to keep such things local to the loop. That would be fixed if I moved the $numrows=$i; statement inside the loop, but it means an extra assignment op per iteration, all but the last being totally pointless. More often than not it's unavoidable, but in this case I can find out how many rows there are before the loop even begins - and then I can check to see whether the loop is even necessary. The code then becomes the second of my first two examples (I check for !=0 rather than >0, since $numrows is nonnegative and if there's any speed difference, the former would be faster than the latter (yes, I could just go if($numrows), but it's narratively jarring to the reader)).
I may comment the } to show what they're associated with as well:
$numrows=mysql_num_rows($resultset);
if($numrows!=0)
{ for($i=0; $i<$numrows; ++$i)
{ $row=mysql_fetch_array($resultset);
//...
} // rof $i=0..$numrows
} // fi $numrows!=0
You may want "endfor" instead of "rof", "endswitch" instead of "hctiws".
Oh, and you may've noticed that I tend to use ++$i instead of $i++ when context makes them equivalent. That's for narrative reasons: the imperative "increment $i" sounds better than the passive statement "$i increments".
Oh, and one last thing that just occurred to me; when the standards document is drawn up, include for each point a summary of the discussion involved in reaching it, and the justifications for doing it that way. So that when someone comes in and you ask them to abide by these standards, and they say "why should I do things that way?" you need merely refer them to the discussion. If there is sufficient justification given, they should be happy to comply.