Forum Moderators: coopster

Message Too Old, No Replies

$this -> variable

         

jaymiri

1:16 am on Dec 18, 2006 (gmt 0)

10+ Year Member



Can anyone explain the use of the $this -> variable? I see it used in scripts all the time, but I don't understand why we always use $this followed by "->". I have tried looking for articles with no luck.

If anyone can explain it or direct me to an article I would greatly appreciate that. Thank you.

eelixduppy

1:21 am on Dec 18, 2006 (gmt 0)




A pseudo-variable, $this is available when a method is called from within an object context. $this is a reference to the calling object (usually the object to which the method belongs, but can be another object, if the method is called statically from the context of a secondary object).

OOP: The Basics [us2.php.net]

...and Welcome to WebmasterWorld!

jaymiri

1:24 am on Dec 18, 2006 (gmt 0)

10+ Year Member



Thanks eelix :)

JerryOdom

1:32 am on Dec 18, 2006 (gmt 0)

10+ Year Member



ah beat me to a reply. Look up object oriented programming php examples if you want some samples.

[edited by: JerryOdom at 1:33 am (utc) on Dec. 18, 2006]