Cory94bailly Posted March 5, 2011 Share Posted March 5, 2011 class replayer extends users { --SNIP-- public $islive = false; --SNIP-- function chat($id, $nick, $chat) { --SNIP-- <----------- } } There's my code, I want to take the variable $islive from the above class and use it in the chat() function. How would I do it? I've tried making it a global inside of the chat() function. Quote Link to comment https://forums.phpfreaks.com/topic/229630-using-variable-from-class-in-function/ Share on other sites More sharing options...
ignace Posted March 5, 2011 Share Posted March 5, 2011 $this->islive; http://www.php.net/manual/en/language.oop5.basic.php Quote Link to comment https://forums.phpfreaks.com/topic/229630-using-variable-from-class-in-function/#findComment-1183168 Share on other sites More sharing options...
Cory94bailly Posted March 5, 2011 Author Share Posted March 5, 2011 $this->islive; http://www.php.net/manual/en/language.oop5.basic.php Yeah, the creator of the script helped me out last night and told me that. I've never worked with objects/classes before. What happened to the "Topic Solved" button here? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/229630-using-variable-from-class-in-function/#findComment-1183290 Share on other sites More sharing options...
ignace Posted March 5, 2011 Share Posted March 5, 2011 What happened to the "Topic Solved" button here? We decided to remove it since no one seems to click it! Quote Link to comment https://forums.phpfreaks.com/topic/229630-using-variable-from-class-in-function/#findComment-1183294 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.