2008-03-23, 12:48 PM
2008-03-23, 01:07 PM
My tutor tought me that $this means "the current object in memory". That means that $this references to the current class so that $this->func1() will call the function func1() inside itself (the current class).
That was proberly not explained very well, so I will find you some documentation for it.
That was proberly not explained very well, so I will find you some documentation for it.
2008-03-23, 01:36 PM
In PHP, if $this is used inside a class, it refers to the current instance of the class.
2008-03-23, 01:43 PM
I see, its just that i want to write something and i need to use $this but no info on internet
2008-03-24, 12:42 AM
I am not sure if that means you understood or not, but either way, I'll break it down some more...
So we have a class:
So it just executes afunction inside the current class, so in that example, if the anothertest() function was called, it would call the test() function in that class.
So we have a class:
<?php
class Awesome{
function test(){
//Do stuff
}
function anothertest(){
$this->test();
}
}
?>
So it just executes afunction inside the current class, so in that example, if the anothertest() function was called, it would call the test() function in that class.
2008-03-24, 05:27 AM
dikidera Wrote:I was searching in google but couldnt find info about the variablethat is used in classes so could u give me a link to some info?$this->
Thanks
Read the first paragraph
http://ca3.php.net/class