yoda699 Posted November 24, 2009 Share Posted November 24, 2009 Hey, I'm in the process of teaching myself stuff (Yes, I am a total beginner). And I got a question about a part of a code that I don't understand. if(isset($_POST['sublogin'])){ $this->procLogin(); } else { echo "blah blah"; } The first line of the code I understand. I also understand how you call a function. What i don't understand is what does $this-> stands for? Does it mean that its a call for a function on the same page? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/182779-help-with-calling-a-function/ Share on other sites More sharing options...
.josh Posted November 24, 2009 Share Posted November 24, 2009 That means that the code you have is within a method (function) of a class, and it is calling another method (function) within that same class. In other words, "call procLogin() of this class" class something { function abc () { // do something } function xyz() { // call function abc in class something. Since it is in the same class as this function, // you can say "$this" as a shortcut $this->abc(); } } Quote Link to comment https://forums.phpfreaks.com/topic/182779-help-with-calling-a-function/#findComment-964722 Share on other sites More sharing options...
yoda699 Posted November 24, 2009 Author Share Posted November 24, 2009 Got it! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/182779-help-with-calling-a-function/#findComment-964731 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.