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. 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 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! 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! 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
Archived
This topic is now archived and is closed to further replies.