note 18563 added to function.get-parent-class
| From: | eric dot brison at anakeen dot com | Date: | Mon, 28 Jan 2002 09:14:14 +0000 |
| Subject: | note 18563 added to function.get-parent-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-25891@lists.php.net to get a copy of this message | ||
To return all ancestors class of an object
function get_ancestors_class($classname) {
$father = get_parent_class($classname);
if ($father != "") {
$ancestors = get_ancestors_class($father);
$ancestors[] = $father;
}
return $ancestors;
}
example :
-----------
Class C {
}
Class B extends C {
}
Class A extends B {
}
print_r (get_ancestors_class("a"));
print_r (get_ancestors_class("b"));
example result :
---------------
Array
(
[0] => c
[1] => b
)
Array
(
[0] => c
)
--
http://www.php.net/manual/en/function.get-parent-class.php
http://master.php.net/manage/user-notes.php?action=edit+18563
http://master.php.net/manage/user-notes.php?action=delete+18563
http://master.php.net/manage/user-notes.php?action=reject+18563