Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Static Getters

mac_doggiemac_doggie Member Posts: 488

I have a class that has some static properties. I don't instantiate this class, but only use the statics...

Since I made those properties private I'd like to be able to use my __Get method to acces the value I have stored in it... But the problem is

echo ENV::$webroot;

will result in:
Fatal error: Cannot access private property ENV::$webroot in ...

this is how it is basicly setup:
class ENV {
private static $webroot;

public static function Initialize() {
self::$webroot = 'some value I get from my inifile';

public static function __Get($value) {
return self::$$value;

I fugured I needed a double $ sign in the getter because $value returns the name of the private static property, so else it would compile to: return self::webroot (without any $) I experimented a bit with this, but nothing sems to be working. Has anyone got any idea?

thanks in advanced...
mailto:[email protected]
the Netherlands...
Sign In or Register to comment.