How to get the child name from within the parent?
| From: | Mathijs | Date: | Mon, 10 Sep 2007 13:17:33 +0000 |
| Subject: | How to get the child name from within the parent? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-261897@lists.php.net to get a copy of this message | ||
Hello there,
Is there a way to get the child class name from within the parent method?
If so, how?
Thx in advance.
Example:
class MyParent {
public static function start() {
// Do something like this???
return get_child_name(); // returns 'MyChild' in this case
}
}
class MyChild extends MyParent {
public static childStart() {
// Should return the child class name.
echo parent::start();
}
}