Update:Archive/2.0/Developers/Best Practices: Difference between revisions

Jump to navigation Jump to search
Line 19: Line 19:


== Coding Methods ==
== Coding Methods ==
=== Do ===
* Create functions for anything you will do more than once.
* Create comment blocks before functinos in [phpDoc http://manual.phpdoc.org/HTMLframesConverter/default/] format.
* Create meaningful to-the-point inline comments when necessary.
* Clean and validate all inputs to prevent SQL injection or malignant HTML.
* Use meaningful variable and function names.
=== Don't ===
* Create functions that do not return anything and echo PHP.
* Use variable or function names that are ambiguous (like $var or validate()).
* Create unnecessary functions.
* Use <? ?> to designate a PHP block.
* Use $array[foo] or $array["foo"] unless it is appropriate (constant or a variable catted with a string).
* Loop MySQL queries.
* Use GET variables in MySQL queries without cleaning them.
* Pass SID via GET.
3,035

edits

Navigation menu