Reputation: 45943
How to get an array of all functions within a class in PHP?
Working in PHP 5.2.8.
Upvotes: 2
Views: 95
Reputation: 3932
I think you are looking for get_class_methods():
http://il2.php.net/manual/en/function.get-class-methods.php
Upvotes: 2
Reputation:
You can do this using ReflectionClass
$class = new ReflectionClass('ClassName');
$methods = $class->getMethods();
$methods
will return an array of ReflectionMethod
objects, which you can then iterate through and get detailed information about each method:
foreach($methods as $method)
{
// $method->getName()
// $method->getParameters()
// etc.
}
Upvotes: 1