Forum Moderators: coopster

Message Too Old, No Replies

PHP Classes Best Practices

         

boxfan

9:25 pm on Jan 10, 2006 (gmt 0)

10+ Year Member



Hello,

What are best practices for creating PHP classes? If I have 3 customer related tables in MySQL and 4 order related tables should I create two classes, one for customer related functions and one for order related functions? Or put all of the functions into one large class?

I'm new to object oriented programming and still trying to get a grasp. I understand the coding aspect, just not the organization.

Thanks

Halfdeck

1:29 am on Jan 12, 2006 (gmt 0)

10+ Year Member



I usually build classes around MYSQL tables.

For example:

class Customer {

public customer_id;
public name;
public address;
public credit_card_number;
public social_security_number;
public sex;
public height;
public date_of_birth;
public favorite_movie;

function __construct() {}

public function name() {
return $this->name;
}

}