trying to understand something. I have a Config class where I define a load of constants. In one of my other classes, I need to use one of the constants from Config. So I start off by using the class
use \CONFIG\Config;
In my class constructor, I then assign the class to a variable
public function __construct() {
$config = new Config;
}
In the consturctor, I can then get access to a constant by doing something like this
$config::BASE_PATH;
So I dont seem to get any complaints when doing this. If I create a class variable though, and change my constructor to the following
public function __construct() {
$this->config = new Config;
$this->config::BASE_PATH;
}
It complains that it is using an incorrect access to a static class member.
Why does it seem to work as a local variable, but not as a class variable?
Thanks