onthespot Posted April 13, 2010 Share Posted April 13, 2010 So I have been looking code to understand it more. The following came up. $database->removeActiveUser($this->username); Could anyone point me in the right direction to working out what this means? I assume the $database is for the include page called database. Thanks Link to comment https://forums.phpfreaks.com/topic/198384-help/ Share on other sites More sharing options...
Ken2k7 Posted April 13, 2010 Share Posted April 13, 2010 $database is a class object. And removeActiveuser is a method of the class $database or a method in a class $database inherits. The -> operator is like the . (dot) operator in JavaScript, Java, C, etc.. If you know Perl, that operator is the same. Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040969 Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Beaten but wth, Read a tutorial on Classes, that will tell you all you need to know, and will explain much faster/better than on here. http://www.lmgtfy.com/?q=PHP+Classes+Tutorial Look for a few, they will show you what is going on here. $database is an instantiated class. removeActiveUser() is a method of that specified class. This method requires an argument of (im guessing) a username. The username is stored in the current class you pulled this code from. (authentication class?). -CB- Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040970 Share on other sites More sharing options...
KevinM1 Posted April 13, 2010 Share Posted April 13, 2010 It's Object Oriented code. The '->' is an object-to-member operator. removeActiveUser() is a method (read: function) of the $database object. $this->username is the argument passed to that method, and is a data member of whatever object's class code you're currently reading. Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040972 Share on other sites More sharing options...
onthespot Posted April 13, 2010 Author Share Posted April 13, 2010 Very grateful for all the responses. It is something I really need to get to grips with. So the -> is the same as the . in C#? In that case, I understand what it does. The $this is one i have seen often, it there a reason to use the word this? I'll look on that link thankyou. Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040973 Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Trust me look for a tutorial on google..... Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040975 Share on other sites More sharing options...
onthespot Posted April 13, 2010 Author Share Posted April 13, 2010 Ok dude, thanks for the direction. Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040978 Share on other sites More sharing options...
KevinM1 Posted April 13, 2010 Share Posted April 13, 2010 Very grateful for all the responses. It is something I really need to get to grips with. So the -> is the same as the . in C#? In that case, I understand what it does. The $this is one i have seen often, it there a reason to use the word this? I'll look on that link thankyou. The following in PHP: $this->someDataMember; Is the same as the following in C#: this.someDataMember; Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040979 Share on other sites More sharing options...
JonnoTheDev Posted April 13, 2010 Share Posted April 13, 2010 http://www.phpfreaks.com/forums/index.php/topic,294324.msg1393195.html Link to comment https://forums.phpfreaks.com/topic/198384-help/#findComment-1040980 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.