ChrisMartino Posted April 20, 2010 Share Posted April 20, 2010 Hey there, I have a function in my class called "IsClientLoggedIn", And all the functions within the class use that function, Is there any way i can call that within the class before the class gets initiated?. Thanks for your time, Christopher. Link to comment https://forums.phpfreaks.com/topic/199192-calling-a-function-in-a-class-from-within-that-same-class/ Share on other sites More sharing options...
jcbones Posted April 20, 2010 Share Posted April 20, 2010 ?? When calling a class function from within the same class, you always use $this->class_function(); Of course, the class will not create it's object until you call the class. Link to comment https://forums.phpfreaks.com/topic/199192-calling-a-function-in-a-class-from-within-that-same-class/#findComment-1045471 Share on other sites More sharing options...
ignace Posted April 20, 2010 Share Posted April 20, 2010 ClassName::IsClientLoggedIn() add static public static function IsClientLoggedIn() Link to comment https://forums.phpfreaks.com/topic/199192-calling-a-function-in-a-class-from-within-that-same-class/#findComment-1045476 Share on other sites More sharing options...
ChrisMartino Posted April 20, 2010 Author Share Posted April 20, 2010 ?? When calling a class function from within the same class, you always use $this->class_function(); Of course, the class will not create it's object until you call the class. Thanks a bunch dude Link to comment https://forums.phpfreaks.com/topic/199192-calling-a-function-in-a-class-from-within-that-same-class/#findComment-1045482 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.