Skip to content
Related Articles

Related Articles

PHP | ReflectionClass getMethod() Function

Improve Article
Save Article
  • Last Updated : 17 Dec, 2019
Improve Article
Save Article

The ReflectionClass::getMethod() function is an inbuilt function in PHP which is used to return a ReflectionMethod for the specified class method.


ReflectionMethod ReflectionClass::getMethod ( string $name )

Parameters: This function accepts a parameter $name which is the method name.

Return Value: This function returns a ReflectionMethod for the specified class method.

Below program illustrate the ReflectionClass::getMethod() function in PHP:

// Using ReflectionClass over the inbuilt class
// 'ReflectionClass'
$class = new ReflectionClass('ReflectionClass');
// Calling the getMethod over the method named
// as 'getMethod'
$method = $class->getMethod('getMethod');
// Getting the ReflectionMethod for the specified
// inbuilt class method.


object(ReflectionMethod)#2 (2) {
  string(9) "getMethod"
  string(15) "ReflectionClass"


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!