There is no simple answer here. I have started using classes where I find
I am writing a lot of related functions that share similar
parameters. Database connection and queries are a good
example. Authentication is another.

I have another class that builds forms, because I just hate the tedium of
coding HTML forms by hand. It is really just a collection of functions,
though, and could work fine as such.

I'm still learning/exploring ... I am always guided by the principle that
whatever makes less work for me (but achieves the same result) is probably
a good thing.

IMHO classes are best for more universal code that really can be used in
many different places. My functions tend to be more application specific.

My 2 cents


On Tue, 16 Jul 2002, Chris Crane wrote:

> Could someone please explain the difference between classes and functions
> and how to use a class. I write alot of PHP, but I never understood this at
> all. I use an include statement in many of my pages and include a file with
> a bunch of functions. For instance, I might have a function called stock();
> In the page I am using I include the file that has this function and I call
> it like this:
> stock($Sym);
> I am wondering if I am doing it the wrong way. So I need to better
> understand classes. What is one, and why would you use it?
> Thanks.

n   i   n   t   i  .   c   o   m
Michael Hall     [EMAIL PROTECTED]

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to