note 46435 added to function.get-class-methods
| From: | epowell at removethis dot visi dot com | Date: | Mon, 11 Oct 2004 15:47:43 +0000 |
| Subject: | note 46435 added to function.get-class-methods | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-78352@lists.php.net to get a copy of this message | ||
I've figured out how to get around my issue described below, using the Reflection API.
<?
/* Pass the name of the class, not a declared handler */
function get_public_methods($className) {
/* Init the return array */
$returnArray = array();
/* Iterate through each method in the class */
foreach (get_class_methods($className) as $method) {
/* Get a reflection object for the class method */
$reflect = new ReflectionMethod($className, $method);
/* For private, use isPrivate(). For protected, use isProtected() */
/* See the Reflection API documentation for more definitions */
if($reflect->isPublic()) {
/* The method is one we're looking for, push it onto the return array */
array_push($returnArray,$method);
}
}
/* return the array to the caller */
return $returnArray;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.get-class-methods.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46435
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46435&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46435&report=yes
Search -- http://master.php.net/manage/user-notes.php