On Fri, 2004-02-06 at 08:29, Vivian Steller wrote: > The problem is, that i want MyClass::getClassname() to return "MyClass"?!
I have the same problem: http://marc.theaimsgroup.com/?l=php-general&m=107575408628272&w=2 I continued discussion of this in the php internals list: http://lists.php.net/article.php?group=php.internals&article=7520 What I have found so far is that it is impossible to get exactly what we are looking for in php4. When I get a moment again I want to renew the discussion on the internals list and see if I can't get $this to be a reference to a static instance of a class within static methods. *crosses fingers* Here is some sample code of what I use to get around this bug. It's leaky and imperfect, but it is inheritable. Also, other than changing the function name you can simply copy and paste the code into inherited classes. Also, while the extra parameter is there you would never call the function with it in your code so the implementation is fairly clean. class Foo { function someFunc($class_name) { return $class_name; } } class Bar extends Foo { function someFunc($class_name = NULL) { return parent::someFunc(isset($class_name) ? $class_name : __CLASS__); } } If you find a better solution *please* let me know. -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php