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(); } Link to comment https://forums.phpfreaks.com/topic/56955-this/ 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. Link to comment https://forums.phpfreaks.com/topic/56955-this/#findComment-281335 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. Link to comment https://forums.phpfreaks.com/topic/56955-this/#findComment-281338 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. Link to comment https://forums.phpfreaks.com/topic/56955-this/#findComment-281342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.