Don't take vB's code as a model for perfect coding!
by
14 Mar 2003
Unlike rumors of vB3, vB2 has astetically horribly written code. Here are some things that you should do (and that vB doesn't always do): 1. When referencing a key in an array, always put the key in quotes. See http://www.php.net/manual/en/language.types.array.php for an explanation. For example, do this: PHP Code:
$myarray['mykey'] = "whatever";
PHP Code:
$myarray[mykey] = "whatever";
PHP Code:
if($a==b&&$c xor ($d+1)){foo();bar()};
PHP Code:
if ($a == $b and $c xor ($d + 1)
3. Indent or be smacked. Bad: PHP Code:
while (true)
PHP Code:
while (true)
I'm sure many more examples are out there. Reply if you have any. |