ReflectionClass::getMethod
PHP function
Edit on GitHub ✎
(PHP 5, PHP 7, PHP 8)
Gets a ReflectionMethod for a class method
Description
ReflectionClass::getMethod(string $name): ReflectionMethod
Gets a ReflectionMethod for a class method.
Parameters
nameThe method name to reflect.
Return Values
A ReflectionMethod.
Errors/Exceptions
A ReflectionException if the method does not exist.
Examples
Basic usage of ReflectionClass::getMethod
php
<?php
$class = new ReflectionClass('ReflectionClass');
$method = $class->getMethod('getMethod');
var_dump($method);
?>The above example will output:
output
object(ReflectionMethod)#2 (2) {
["name"]=>
string(9) "getMethod"
["class"]=>
string(15) "ReflectionClass"
}See Also
ReflectionClass::getMethods