View Single Post
Old 09-26-2009, 10:20 PM   #6 (permalink)
ETbyrne
how quixotic are you?
 
ETbyrne's Avatar
 
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
ETbyrne is on a distinguished road
Default

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
__________________
Dingo Web Systems > http://www.dingocode.com
My Website > http://www.evanbot.com
ETbyrne is offline  
Reply With Quote