Re: Re: Syntax problem - dynamic static member access
| From: | Jake Press | Date: | Sun, 07 Nov 2004 07:43:48 +0000 |
| Subject: | Re: Re: Syntax problem - dynamic static member access | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-201405@lists.php.net to get a copy of this message | ||
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) {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 Pressreturn self::$var;} } Hi Jason,