Re: [nyphp-talk] static variable variable?

2007-12-20 Thread Michael B Allen
Actually this lead me to a solution that didn't use the static array at all. I really just wanted the child class to be able to map some strings. So I just some if return blocks in the overridden method: protected function mapName($name) { if ($name === 'foo') return 'bar';

Re: [nyphp-talk] static variable variable?

2007-12-20 Thread Nick Galbreath
Hi, if I understood your issue correctly, then in C++, Java, and PHP5 you'd do something like this: abstract class Foo { public function doit() { echo $this->gettext(); } abstract protected function gettext(); } class Bar extends Foo { static $msg = "this is some text\n"; public function gettex

Re: [nyphp-talk] static variable variable?

2007-12-20 Thread Michael B Allen
On 12/20/07, John Campbell <[EMAIL PROTECTED]> wrote: > Humm... > > The only thing I can think of is to do something like: > $v = get_class_vars(get_class($this)); > print_r($v['_staticvar']); This does work in my case. But, I the code could get invoked quite a bit which makes me wonder if the ov

Re: [nyphp-talk] static variable variable?

2007-12-20 Thread Ken Robinson
At 10:13 PM 12/19/2007, Michael B Allen wrote: 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'; Try using double quotes instead of single quotes: $_staticvar