I want to use PHP's reflection features to retrieve a list of parameter names from a method. I have a class like this:
class TestClass {
public function method($id, $person, $someotherparam) {
return;
}
}
I can get the list using code like this:
$r = new ReflectionClass('TestClass');
$methods = $r->getMethods();
foreach($methods as $method) {
$params = $method->getParameters();
$p = $params[0]; // how can I combine this and the next line?
echo $p->name;
I want to know how to access the class members from the array, so I don't have to do an assignment. Is this possible? I tried something like echo ($params[0])->name
but I get an error.