note 30999 added to function.get-parent-class
| From: | tim at correctclick dot com | Date: | Sun, 06 Apr 2003 01:48:44 +0000 |
| Subject: | note 30999 added to function.get-parent-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46271@lists.php.net to get a copy of this message | ||
A slightly more cryptic but faster get_ancestors function:
function get_ancestors ($class) {
for ($classes[] = $class; $class = get_parent_class ($class); $classes[] = $class);
return $classes;
}
(The second part of the for is implicitly testing for $class != ""). Recursion is
considerably slower than looping, so you probably want to use this function.
Hope someone finds it useful.
--
http://www.php.net/manual/en/function.get-parent-class.php
http://master.php.net/manage/user-notes.php?action=edit+30999
http://master.php.net/manage/user-notes.php?action=delete+30999
http://master.php.net/manage/user-notes.php?action=reject+30999