Re: Getting the name of the Class

From: Date: Thu, 27 May 2004 17:42:52 +0000
Subject: Re: Getting the name of the Class
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187064@lists.php.net to get a copy of this message
Since you're invoking this as a static method the only solution that comes to mind is to use the PHP5 builtin class Reflection_Method and/or Refelction_Class. Perhaps something like: <?php Class Test { function Test() {
    echo 'Test';
} } Class MyClass extends Test { function Debug() {
    print 'Hello MyClass';
} } $reflection = new Reflection_Method('MyClass', 'Test'); echo "The declaring class is: " . $reflection->getDeclaringClass()->name; ?> For a good overview of what you can do with Reflection_Method, see: http://sitten-polizei.de/php/reflection_api/docs/language.reflection.class.reflection_method.html

« previous php.general (#187064) next »