PHP how to list out all public functions of class

class, php

Solution

Yes you can, take a look at the reflection classes / methods.

http://php.net/manual/en/book.reflection.php and http://www.php.net/manual/en/reflectionclass.getmethods.php

$class = new ReflectionClass('Apple');
$methods = $class->getMethods(ReflectionMethod::IS_PUBLIC);
var_dump($methods);

Problem

I've heard of `get_class_methods()` but is there a way in PHP to gather an array of all of the public methods from a particular class?

Original source