ReflectionClass::getMethod

(PHP 5, PHP 7)
Gets a ReflectionMethod for a class method.
public ReflectionMethod ReflectionClass::getMethod ( string $name )

Gets a ReflectionMethod for a class method.

Parameters:
name

The method name to reflect.

Returns:

A ReflectionMethod.

Exception:

A ReflectionException if the method does not exist.

Examples:
Basic usage of ReflectionClass::getMethod()
<?php
$class = new ReflectionClass('ReflectionClass');
$method = $class->getMethod('getMethod');
var_dump($method);
?>

The above example will output:

object(ReflectionMethod)#2 (2) {
  ["name"]=>
  string(9) "getMethod"
  ["class"]=>
  string(15) "ReflectionClass"
}
See also:

ReflectionClass::getMethods() -

doc_php
2016-02-24 16:13:21
Comments
Leave a Comment

Please login to continue.