Re: Classes vs. Functions

From: Date: Wed, 17 Jul 2002 22:47:25 +0000
Subject: Re: Classes vs. Functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108176@lists.php.net to get a copy of this message
Thank you for your 2 cents I am just learning and appreciate your comments. ----- Original Message ----- From: "Michael Hall" <olc@ninti.com> To: "Chris Crane" <ccrane@inxdesign.com> Cc: <php-general@lists.php.net> Sent: Tuesday, July 16, 2002 11:13 PM Subject: Re: [PHP] Classes vs. Functions > > 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 > > Michael > > 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 > php-python-perl-mysql-postgresql > -------------------------------- > Michael Hall ninti@ninti.com > -------------------------------- > > >

« previous php.general (#108176) next »