KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to get the name of the top level class from an extended class, without setting it from the top level class. See example below, I would like to get 'Foo' from Base. I know I could set a variable from Foo, but hoping to skip the extra step. Thanks. class Base { function __construct() { echo '<p>get_class: '.get_class().'</p>'; echo '<p>__CLASS__: '.__CLASS__.'</p>'; } } class Foo extends Base { } $test = new Foo(); (PHP 5.2.4+)
Tags (comma-separated)
Save Edits
Cancel