Re: [PHP] runtime access to static variable

2009-07-10 Thread Martin Scotta
On Fri, Jul 10, 2009 at 4:25 PM, Madbreaks wrote: > > > Jack Bates-2 wrote: >> >> How do I access a static variable when I do not know the name of the >> class until runtime? >> > Why not just: > > eval('$staticVal = '.get_class($myClass).'::staticVarName;'); > > ...now the value is in $staticVal.

Re: [PHP] runtime access to static variable

2009-07-10 Thread Madbreaks
Jack Bates-2 wrote: > > How do I access a static variable when I do not know the name of the > class until runtime? > Why not just: eval('$staticVal = '.get_class($myClass).'::staticVarName;'); ...now the value is in $staticVal. Or am I missing something here? No need to tell me eval is evi

Re: [PHP] runtime access to static variable

2008-12-16 Thread Micah Gersten
Jack Bates wrote: > How do I access a static variable when I do not know the name of the > class until runtime? > > I have the following example PHP: > > ket% cat test.php > > class Test > { > public static > $STEPS = array( > 'foo', > 'bar'); > } > > $className = 'Test'; > > va

Re: [PHP] runtime access to static variable

2008-12-16 Thread ceo
Try this, maybe: ($className)::$STEPS -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] runtime access to static variable

2008-12-16 Thread Jack Bates
How do I access a static variable when I do not know the name of the class until runtime? I have the following example PHP: ket% cat test.php http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php