PHP: Get method arguments?

In php, I can check all available methods for an object as follows:

$methods = get_class_methods($object); 

But how can I see which arguments should be sent to these methods?

Is there a function for this?

+41
object methods php class arguments
Aug 2 '10 at 12:17
source share
1 answer

You can use reflection ...

 $r = new ReflectionMethod($className, $methodName); $params = $r->getParameters(); foreach ($params as $param) { //$param is an instance of ReflectionParameter echo $param->getName(); echo $param->isOptional(); } 
+86
Aug 02 '10 at 12:21
source share



All Articles