kwdrysdale Posted November 8, 2007 Share Posted November 8, 2007 Hi. I was truly excited to find this site and look forward to visiting often and learning as much as I can so that I can work more in PHP and then be able to return the favour and help others learn as well. I am really new to PHP but have some general programming experience from my younger days and in school. I'm not scared to try things and totally screw up a file (as I have done over and over as I learned how to interact with a database) and learn most things really quickly. On with the question...I have tried searching the net, tried searching here, but because most search engines take out the special characters I get a whole lot of articles containing the word "this." I am working on modifying a login script (btw the phpfreaks login script would be GREAT to check out!) and don't really know what $this-> means. Here is an example of what I have in some code: function Session(){ $this->time = time(); $this->startSession(); } That is one small portion. There are other spots where it looks like it is defining a variable such as: if(!$this->logged_in){ $this->username = $_SESSION['username'] = GUEST_NAME; $this->userlevel = GUEST_LEVEL; $database->addActiveGuest($_SERVER['REMOTE_ADDR'], $this->time); } I am not asking anyone to tell me exactly what is happening in the script as I have a basic understanding of what most things are doing, just not a detailed understanding of some of the code yet. "$this->" is something that I see a lot in this script and is something I would like to be able to understand more. Is there somewhere I can find information on this? I have tried php.net but searching is impossible as explained above. Any help would be greatly appreciated. Thanks. Kevin Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted November 8, 2007 Share Posted November 8, 2007 Its a nomenclature dealing with OOP based programing. It is talking about an array $this and then the item with the key time so $this['time'] is another way to write it. I personally don't use OOP as it seems to complicate things, but some people speak very highly of it. all it is doing though is setting an array node's value. fyi OOP = object oriented programing Quote Link to comment Share on other sites More sharing options...
yanisdon Posted November 8, 2007 Share Posted November 8, 2007 check this out: http://www.php.net/oop Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 8, 2007 Share Posted November 8, 2007 http://www.phpfreaks.com/forums/index.php/topic,95867.0.html Quote Link to comment Share on other sites More sharing options...
kwdrysdale Posted November 8, 2007 Author Share Posted November 8, 2007 Thank you so much for the replies. It is all making so much more sense. I will mark this solved. Kevin 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.