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
Help on $this->
Moderator: General Moderators
- mudkicker
- Forum Contributor
- Posts: 479
- Joined: Wed Jul 09, 2003 6:11 pm
- Location: Istanbul, TR
- Contact:
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
http://www.php.net/manual/en/language.oop.php
http://www.devarticles.com/art/1/349
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).
$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).