09-26-2009, 10:20 PM
|
#6 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
Variable, function, and class names: lowercase with underscores
Constants: caps
Indention: tabs (doesn't work in this code editor)
PHP Code:
define('MY_CONSTANT','value');
class mysql { private $con;
public function __construct($host,$database,$user,$pass=NULL) { // ... }
public function query($sql) { // ... return($results); } }
$mysql = new mysql('localhost','mydb','root','pass');
$results = $mysql->query('SELECT * FROM `mytable`');
I tend to avoid CamelCase because a lot of times you come across strange looking names like getId(). Then you have to decide between breaking your code convention to make it look right or just leaving it to look odd.
Plus typing all lowercase is easier on the fingers 
|
|
|
|