maettig.com

Thiemos Archiv

Add to my personal PHP style guide:
  • Turn register_globals off. Use $_POST etc. instead.
  • Don't rely on magic quotes. It may be disabled.
  • Classe names are upper case first. Function and variable names are lower case first.
  • Private class members and properties are pretended by an underscore.
  • Don't use underscores in function and variable names. Use $someVarName instead of $some_var_name for example.
  • Same goes for database table and field names. Use underscores in relations only.
  • Use double quotes for strings unless single quotes are realy needed. Double quotes aren't slower.
  • while(each()) is faster than foreach() in most cases, except for the simple foreach($array as $value) read only loop.
  • Use for() instead of while() if possible. That's faster in most cases.
  • Don't use count() inside of for(). That's horrible slow. Calculate the loop length before.
[via BlueShoes and PEAR]

Kommentare zu diesem Beitrag können per E-Mail an den Autor gesandt werden.

[ ← Zurück zur Übersicht ]

Impressum & Datenschutz