get class, method list from object in php


get list of class, method from object of php


$class_name = get_class($objectVar);
$mainclass = array_values(class_parents($class_name));
$classlist = array_merge(array($class_name), $mainclass);
echo "<ul>";
foreach($classlist as $classname){
echo "<li><strong>$classname</strong></li><ul>";
foreach(get_class_methods($classname) as $methodname){
if(!is_null($classname)){
echo "<li>".$methodname."</li>";
}
}
echo "</ul>";
}
echo "</ul>";

Advertisements
Posted in php

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s