Posted by 4sak3n 0ne on 08/31/07 17:52
On Aug 31, 10:44 am, stiki <lapto...@gmail.com> wrote:
> How and what does this mean in php: ($this->varname)
>
> I can't seem to find this by searching Google, because the "->" are
> removed from my search query.
>
> Cheers,
> Igor Terzicwww.stikimedia.com
-> is used when referring to a classes inner workings. $this is a
special variable used within a class to refer to itself.
Example:
----------------------------------------
class Example{
var $classVariable = "Something";
function testFunction(){
echo "I'm just a simple function.";
}
function show(){
$this->testFunction();
}
}
$c = new Example;
$c->testFunction(); // Returns I'm just a simple function.
$c->show(); // Returns I'm just a simple function.
echo $c->classVariable; // Returns Something
------------------------------------------
Hope that clears thing up for you.
[Back to original message]
|