Jump to content

Using variable from class in function


Cory94bailly

Recommended Posts

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

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? :P

 

Thanks!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.