[nycphp-talk] static variable variable?
Michael B Allen
ioplex at gmail.com
Wed Dec 19 22:13:24 EST 2007
I have a bunch of subclasses that define a static varible that I need
to access in the parent class. So I'm trying something like:
$_staticvarname = get_class($this) . '::$_staticvar';
print_r($$_staticvarname);
But this doesn't work. I just get:
Undefined variable: Sublcass::$_staticvar
If I do:
print_r(Subclass::$_staticvar)
it works so I know it's just an evaluation issue.
I can't use const because the variable is an array. I don't want to
hardcode the subclass name in the parent class and I want to use a
static variable reasoning that it uses less memory.
Is there any way to do this?
Mike
--
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/
More information about the talk
mailing list