PHPNS Posted June 24, 2007 Share Posted June 24, 2007 Hi, Can someone please explain to me the, logic behind using $this->, in the following code, or at least point me to appropriate online explanations: class counter { var $db; var $sid; var $dbtable; var $online; function counter () { global $db, $tblcounter; $this->db = $db; $this->table = $tblcounter; $this->sid = session_id(); $this->do_count(); } Quote Link to comment Share on other sites More sharing options...
.Stealth Posted June 24, 2007 Share Posted June 24, 2007 the above example is a class, used in object orientated programming. if you dont know what object orientated programming is then you've got some learning ahead of you. i tried to learn object orientated programming and quit after a hour lol. Quote Link to comment Share on other sites More sharing options...
trq Posted June 24, 2007 Share Posted June 24, 2007 $this is a special variable that points to the current instantiation of the object its contained within. Quote Link to comment Share on other sites More sharing options...
PHPNS Posted June 24, 2007 Author Share Posted June 24, 2007 Yes, I'm familiar with the concept of object oriented programming. Just need to figure out how to do it . Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.