downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ReflectionClass::getProperties> <ReflectionClass::getNamespaceName
Last updated: Fri, 30 Oct 2009

view this page in

ReflectionClass::getParentClass

(PHP 5)

ReflectionClass::getParentClassGets parent class

Beschreibung

public object ReflectionClass::getParentClass ( void )

Warnung

Diese Funktion ist bis jetzt nicht dokumentiert. Es steht nur die Liste der Argumente zur Verfügung.

Parameter-Liste

Diese Funktion hat keine Parameter.

Rückgabewerte

A ReflectionClass.

Siehe auch



add a note add a note User Contributed Notes
ReflectionClass::getParentClass
meecrob at k42b3 dot com
20-Jun-2008 10:47
When your class extends a parent class you maybe want the name
of them. Using getParentClass() is maybe a bit confusing. When
you want the name as string try the following.

<?php
$class
= new ReflectionClass('whatever');

$parent = (array) $class->getParentClass();

if(
array_key_exists('name', $parent))
{
   
# name of the parent class
   
$parent = parent['name'];
}
else
{
   
# no parent class avaible
   
$parent = false;
}
?>

When you turn getParentClass() to an array it will result either
array(0 => false) when no parent class exist or
array('name' => 'name of the parent class'). Tested on PHP 5.2.4

 
show source | credits | sitemap | contact | advertising | mirror sites