Some code Im working with uses the line
pg_query($this->link, $query)
What does the $this->link signify?
Thanks
What does "->" signify in php
Moderator: General Moderators
Re: What does "->" signify in php
-> is for accessing variables and functions from an object.
$this is a special variable that refers to the class that the code is located in.
As usual, the manual is great for answering your PHP-related questions.
$this is a special variable that refers to the class that the code is located in.
As usual, the manual is great for answering your PHP-related questions.
Code: Select all
class A {
function x() { echo get_class($this); }
}
class B {
var $b = 123;
}
$a = new A;
$a->x(); // prints "A"
$b = new B;
echo $b->b; // prints "123"Re: What does "->" signify in php
OK thank you.
I think I understand what $this does, but I am not sure...
What does $this do? What is the difernce between $this->$whatever and just saing $watever?
thank
I think I understand what $this does, but I am not sure...
What does $this do? What is the difernce between $this->$whatever and just saing $watever?
thank
Re: What does "->" signify in php
$this->whatever is the "whatever" variable that's part of the current class. $whatever is just a variable in a function.swraman wrote:What is the difernce between $this->$whatever and just saing $watever?