note 100978 added to reflectionclass.getparentclass

From: Date: Thu, 18 Nov 2010 12:35:00 +0000
Subject: note 100978 added to reflectionclass.getparentclass
Groups: php.notes 
Request: Send a blank email to php-notes+get-174148@lists.php.net to get a copy of this message
When you want to find all parents (parent, parent of parent, parent of parent's parent and so on) try: <?php $class = new ReflectionClass('whatever'); $parents = array(); while ($parent = $class->getParentClass()) { $parents[] = $parent->getName(); } echo "Parents: " . implode(", ", $parents); ?> ReflectionClass::getParentClass() can return a ReflectionClass object of the parent class or false if no parent. (PHP Version 5.1.6) ---- Server IP: 213.249.64.162 Probable Submitter: 95.97.107.148 ---- Manual Page -- http://www.php.net/manual/en/reflectionclass.getparentclass.php Edit -- https://master.php.net/note/edit/100978 Del: integrated -- https://master.php.net/note/delete/100978/integrated Del: useless -- https://master.php.net/note/delete/100978/useless Del: bad code -- https://master.php.net/note/delete/100978/bad+code Del: spam -- https://master.php.net/note/delete/100978/spam Del: non-english -- https://master.php.net/note/delete/100978/non-english Del: in docs -- https://master.php.net/note/delete/100978/in+docs Del: other reasons-- https://master.php.net/note/delete/100978 Reject -- https://master.php.net/note/reject/100978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174148) next »