Re: [PHP] Classes vs. functions?

2003-06-03 Thread olinux
Here is an excellent article describing classes/objects - what they are and are not. http://phpmag.net/itr/online_artikel/psecom,id,284,nodeid,114.html olinux > > Can someone please explain to me when is a class > useful over a set of > > functions? __ Do you Y

Re: [PHP] Classes vs. functions?

2003-06-03 Thread Steven Walker
Can someone please explain to me when is a class useful over a set of functions? Almost always. Object oriented programming offers many many advantages (that I cannot get into depth on here). There are a few exceptions where you would not use classes, such as utility functions like max() and mi

Re: [PHP] Classes vs. Functions

2002-07-17 Thread Christopher J. Crane
Thank you for your 2 cents I am just learning and appreciate your comments. - Original Message - From: "Michael Hall" <[EMAIL PROTECTED]> To: "Chris Crane" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 16, 2002 11:13 PM Su

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Towell
[snip] > A CLASS after all is just a collection of functions with a > data model. But ... there is modular and then there is OO imho. [snip] A class is more than just a bunch of functions that have been placed together. If you want to do that, then you might as well just throw them all into the s

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Peter J. Schoenster
On 17 Jul 2002 at 12:43, Michael Hall wrote: > 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. Yeah. > I have an

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Michael Hall
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 o

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Towell
> > Martin Clifford wrote: > > Could someone please explain the difference between classes and functions > > and how to use a class. > > Whether you should like OOP or not is a religious matter, so I will not > enter the field. OOP has its pluses and its minuses. It's a technique, > not an ult

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Alberto Serra
ðÒÉ×ÅÔ! Martin Clifford wrote: > Could someone please explain the difference between classes and functions > and how to use a class. Well, that's a 1 billion $$ question. I don't think one can fully grasp that difference by reading an email. I strongly suggest you to buy yourself a book about

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Steve Bradwell
l Message- From: Chris Crane [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 11:40 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Classes vs. Functions Wow...this is pretty cool. Do you HAVE to declareall your varibles ahead of time? "Steve Bradwell" <[EMAIL PROTEC

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Chris Crane
return false; >} else { >return true; >} > } > > } > > ?> > > And now in any .php file you include this .obj file and use it as follows. > > $db1 = new mysqldb(); // create a new instance of the mysql objec

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Chris Crane
thanks Jay. "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message 000e01c22cdd$0d0c7530$8102a8c0@niigziuo4ohhdt">news:000e01c22cdd$0d0c7530$8102a8c0@niigziuo4ohhdt... > [snip] > This helps quite a bit Thank you. > I am just wondering if I should make classes instead of functions? What > would be th

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford
I'm still trying to figure that out, but the fog is clearing slowly but steadily :o) >From what I've heard on this and other lists, it's all a matter of preference. >Obviously those that come from an object-oriented environment (Java, etc), will lean >toward this method, while others stay with

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Jay Blanchard
[snip] This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know? [/snip] You should keep classes and functions seperate in your thought process, they are not the same and not meant to do or be the same thin

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Steve Bradwell
e method that does all the work so $db1->setTransactionSwitch("false"); //you don't have to recode it. If it fails roolback. if($db1->getTransactionSwitch()=="false");{ $db1->rollback(); }else{ $db1->commit(); } Classes al

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Chris Crane
Is there an advantage to Classes vs. Functions? "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message 000c01c22cdb$11485c10$8102a8c0@niigziuo4ohhdt">news:000c01c22cdb$11485c10$8102a8c0@niigziuo4ohhdt... > [snip] > example? > [/snip] > > http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Chris Crane
This helps quite a bit Thank you. I am just wondering if I should make classes instead of functions? What would be the benefit of that? Do you know? "Martin Clifford" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Here is a sample code (don't take this as gospel

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford
Here is a sample code (don't take this as gospel... Jay knows more about OOP than I do, I'm sure!): class Car { var $make; var $model; function setMake($x) { $this->make = $x; } function setModel($y) { $this->model = $y; } } $make and $model are the prop

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Jay Blanchard
[snip] example? [/snip] http://www.devshed.com/Server_Side/PHP/FormValidatorClass/page1.html Good tutorial Jay * * Want to meet other PHP developers * * in your area? Check out: * * http://php.meetup.com/* * No developer is an island ...

Re: [PHP] Classes vs. Functions

2002-07-16 Thread Chris Crane
It helps a little bit, thank you. Could you provide some code as to what a Class looks like. I am just trying to understand it better and if I see it, it might help. "Jay Blanchard" <[EMAIL PROTECTED]> wrote in message 000401c22cd8$54ce9ce0$8102a8c0@niigziuo4ohhdt">news:000401c22cd8$54ce9ce0$8102a

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Martin Clifford
To add to the below, object classes, can have their own set of functions, called methods. These methods are specific to the function, and ALL functions within a class treat any properties (variables) within the class as global. So if you have a class "Car" with two properties ("Make" and "Mode

RE: [PHP] Classes vs. Functions

2002-07-16 Thread Jay Blanchard
[snip] 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 calle