I have a class with member variables. What is the syntax in PHP to access the member variables from within the class when the class is being called from a static contex
Basically I want to call a class method (but not create a new object), but when the class method is called, I want a handful of static constant variables to be initialized that need to be shared among the different class methods.
Try this
class ClassName {
static $var;
function functionName() {
echo self::$var = 1;
}
}
ClassName::functionName();