Re: Get class name in static method
| From: | Stut | Date: | Mon, 20 Mar 2006 18:28:05 +0000 |
| Subject: | Re: Get class name in static method | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-232244@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
Stut wrote:I mean object as short for objective, but whatever ;-).What do I put where the ???s are? I've tried __CLASS__ and get_class() but both give me the base class name. Short of passing the classname to the static function I'm at a loss as to how to do this. However, Bar::Create('Bar') is a bit too sucky for me to be happy with it and kinda defeats the object.(purpose not object ;-)
either suck on it or use another language :-P. this _PROBLEM_ exists since day 1 of php5 - there is no decent solution. there has been discussion of this problem on the internals mailing list, most of them seem to agree something is required here but no definite fix has been implemented.I thought as much. Shame really, I had a really elegant solution planned for this problem. Oh well, I'll just have to create a throwaway instance whenever I use these methods... such is life. -Stut