User Tools

Site Tools


getsimple_coding

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
getsimple_coding [2011/03/13 18:52]
ccagle8
getsimple_coding [2013/04/19 14:54] (current)
Line 5: Line 5:
   * All files, classes, class methods, class variables, functions and defines will be documented with DocBlocks   * All files, classes, class methods, class variables, functions and defines will be documented with DocBlocks
   * Assume all user input will be malicious - properly sanitize all form entries and $_GET, $_POST and $_COOKIE variables   * Assume all user input will be malicious - properly sanitize all form entries and $_GET, $_POST and $_COOKIE variables
-  * Minimize the use of double quotes. Double quotes force the PHP parser to check the string for variables to evaluate, even if there aren't any variables to evaluate. It is better to use single quotes and concatenate variables <​code>​$string = 'Some plain text and a ' .$variable;</​code> ​is better ​than <​code>​$string = "Some plain text and a $variable";</​code>​ +  * Minimize the use of double quotes. Double quotes force the PHP parser to check the string for variables to evaluate, even if there aren't any variables to evaluate. It is better to use single quotes and concatenate variables ​like this: <​code>​$string = 'Some plain text and a ' .$variable;</​code>​ than to use double quotes like this: <​code>​$string = "Some plain text and a $variable";</​code>​ 
-  * Do not use [[http://​en.wikipedia.org/​wiki/​Ternary_operation#​Perl.2C_PHP|ternary operators]]. Instead of this  <​code>​$dynamic = ($language == '​php'​ ? true : false);</​code>​ use this: <​code>​if($language == '​php'​) {+  * Do not use [[http://​en.wikipedia.org/​wiki/​Ternary_operation#​Perl.2C_PHP|ternary operators]]. Instead of this <​code>​$dynamic = ($language == '​php'​ ? true : false);</​code>​ use this: <​code>​if($language == '​php'​) {
   $dynamic = true;   $dynamic = true;
 } else { } else {
   $dynamic = false;   $dynamic = false;
 }</​code>​ }</​code>​
 +  * Do not use PHP short tags ''<?​= ?>''​. Instead, use the full tag syntax: ''<?​php ​ ?>'' ​
getsimple_coding.1300042378.txt.gz · Last modified: 2013/04/19 14:53 (external edit)