Re: Re: Syntax problem - dynamic static member access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Barnett wrote:

Jake, as you probably already know you usually have to give the class name when attempting to get a static variable, i.e.

YourClassName::$bob;

You *can* dynamically refer to a static class variable from within an object without knowing the name of the class; this is what self is for. i.e.

class YourClassName {
  function getStatic($var) {
    return self::$var;
  }
}

Hi Jason,

Thanks for your response. :)

That doesnt seem to be an answer at all applicable to my question tho...

Ofcourse i realise you need to give the class name when attempting to get a static variable...
heh... im sure it would be interesting referencing a class without its name :)


Yours Sincerely
Jake Press

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux