dotkpay Posted September 1, 2011 Share Posted September 1, 2011 Hello, Is it possible to use variables that are declared outside or plainly within a class, and if its possible, how? thanks in advance Link to comment https://forums.phpfreaks.com/topic/246207-oop-outside-variables/ Share on other sites More sharing options...
Psycho Posted September 1, 2011 Share Posted September 1, 2011 If you need to utilize values set outside a class within the class, then you should pass those variables into the class - using a setter method. As for "plainly within a class", not 100% sure what you mean, but the values should be "properties" of the class and then you can set the value anywhere in the class using $this->varname Link to comment https://forums.phpfreaks.com/topic/246207-oop-outside-variables/#findComment-1264472 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.