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 the procedural side of things (using >functions). It's all a matter of preference, and just yet I haven't decided which is >more useful :o) Good luck! Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Chris Crane" <[EMAIL PROTECTED]> 07/16/02 11:19AM >>> 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... 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 properties of the Car class, and setMake() and setModel() are the methods of the Car class. You don't actually get an object until make a *new* one. Like this: $passat = new Car; $passat->setMake("Volkswagen"); $passat->setModel("Passat"); This assigns the new object, "passat", the properties relating to it's make and model, using the methods setMake and setModel. I'm sure this is right, but I'm sure I'm probably wrong (hehe, confused?). I'm also sure someone will correct me if I am! :o) Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> "Chris Crane" <[EMAIL PROTECTED]> 07/16/02 11:06AM >>> 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$8102a8c0@niigziuo4ohhdt... > [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 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? > [/snip] > > A class is the representation of an object, such as a person, place, or > thing. > A function is a group of commands that can be called for a specific purpose. > > function addNumbers() > > A function can be performed on an object, but an object (the logical > extension of class) cannot be performed on a function. Does that help? > > Jay > > "Cleverly disguised as a responsible adult" > > ************************************* > * Want to meet other PHP developers * > * in your area? Check out: * > * http://php.meetup.com/ * > * No developer is an island ... * > ************************************* > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php