On Wed, 2004-03-17 at 15:55, Jeff McKeon wrote: > I've been using PHP for about 6 months and I'm ok with it but I'm now > starting to get into more advanced stuff and inheriting project that > other people have coded. One of the major stumpers I have is any line > of code that contains: > > $this-> > > What does this do? I know it has something to do with classes but can't > quite get my head around it. > > Thanks, > > Jeff
It refers to the object upon which the class method was called. So outside of the class you might have: $foo = new FooClass(); $foo->doSomething(); then inside the class you might have the following: class FooClass { function doSomething() { $this->doSomethingElse(); } function doSomethingElse() { $foo = 1; return (++$foo === $foo++); // ;) } } Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php