your question is hard to answer. The difference between classes and functions is like the difference between a toolbox, and a spanner. A class is a container, that contains functions, and variables, or as they are called in Object-Oriented-Speak(methods, and properties).
A method is a function that exists in a class, although in php they are still declared as functions. function do_something(){ echo "Im doing something this is a function"; } class class_thing{ function method_of_thing(){ echo "I am a method(function) that exists inside of class class_thing"; } } Hope this helps, but from what I'm reading, you really need to learn some basics before you even think about classes. Worry about functions for now. Read the PHP manual(you don't get better docs, than the php ones). It explains things like that in a easy to use manner. I also don't know of a better programming tutorial than the PHP manual. Good luck Rory On Sat, 11 Dec 2004 10:23:12 -0800, Robby Russell <[EMAIL PROTECTED]> wrote: > On Sat, 2004-12-11 at 13:03 -0500, R. Van Tassel wrote: > > > > Can someone give me a distinction between the two and when to use / not use > > them? > > > > > > > > I want to thank everyone who replied about my"For" loop question. All the > > answers were VERY helpful! Thanks very much. > > You might want to pick up a book on programming to read up on this. > > In a nutshell, a function should do something specific. It's good to use > functions when you do the same thing in different places in your code so > that you don't need to copy/paste your code over and over. > > function foo() > { > $x = 1; > $y = 2; > return $x + $y; > } > > $bar = foo(); > > print $bar; > ----- > OUTPUT: > 3 > > A class/object is a collection of functions and variables that are > contained within their own scope. (vague description) > > class foobar > { > var $x = 10; > > var $y = NULL; > > function foobar($y) > { > $this->y = $y; > } > > function add() > { > return $this->x + $this->y; > } > > function subtract() > { > return $this->x - $this->y; > } > > } > > $object =& new foobar(4); > > print $object->add() . "\n"; > print $object->subtract() . "\n"; > > # set y to a new number > $object->y = 2; > > print $object->add() . "\n"; > print $object->subtract() . "\n"; > > -------- > OUTPUT: > > 14 > > 6 > > 12 > > 8 > > As it sounds like you're still new to this, I would pick up a book or > read some material online that will better show you when to use either > and play around with them both. > > Have fun > > -Robby > > -- > /*************************************** > * Robby Russell | Owner.Developer.Geek > * PLANET ARGON | www.planetargon.com > * Portland, OR | [EMAIL PROTECTED] > * 503.351.4730 | blog.planetargon.com > * PHP/PostgreSQL Hosting & Development > * --- Now supporting PHP5 --- > ****************************************/ > > -- > 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