Can anyone explain me what does $this->connection mean another words what does $this really do and how it works.
In PHP, as with most object oriented languages, $this is a reference variable that allows access to members variables of the class $this is used in. For example:
[PHP]
class NumberClass {
var $number;
function printNumber() {
printf($this->number);
}
}
[/PHP]
Will print the value of that class's $number variable, whatever that may be for the particular object. Somewhere else in code you could do this:
[PHP]
$numberObject = new NumberClass();
$numberObject->number = 5;
$numberObject->printNumber();
[/PHP]
And the output would be 5. Hope that helps explain the $this variable a bit.
-Fredric
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Offline 80 posts
since Aug 2005