Help on $this->

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ravenance
Forum Newbie
Posts: 2
Joined: Tue Oct 07, 2003 1:42 pm
Contact:

Help on $this->

Post by ravenance »

Alright I have seen this around, and I have no been able to figure out how it works and have not been able to find documentation anywhere.

Can anyone help me by linking me to an explanation, or an example? Or explain how. It would be greatly appreciated thanks!

-ravenance
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

This is mostly a part of Object Oriented Programming in PHP. You can use these links below:

http://www.php.net/manual/en/language.oop.php
http://www.devarticles.com/art/1/349
ravenance
Forum Newbie
Posts: 2
Joined: Tue Oct 07, 2003 1:42 pm
Contact:

Post by ravenance »

Thanks a ton man, I am gonna read and try to comprehend it =)

-ravenance :twisted:
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

you are welcome.
i think these are the most valuable articles and manuals for this subject, i really show respect to them ;)
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

Inside a class definition, $this just means "this class".

$this->var; is a class property.

$this->doSomething(); runs a class method.

$this->object =& new Object($this); is interesting. Instantiates a new class (as a property of $this) and passes $this to the new object, ie you can pass $this as an argument if you need to (inside the class definition).
Post Reply