PHP | ReflectionClass getMethod() Function
Last Updated :
17 Dec, 2019
The ReflectionClass::getMethod() function is an inbuilt function in PHP which is used to return a ReflectionMethod for the specified class method.
Syntax:
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:
<?php
$class = new ReflectionClass( 'ReflectionClass' );
$method = $class ->getMethod( 'getMethod' );
var_dump( $method );
?>
|
Output:
object(ReflectionMethod)#2 (2) {
["name"]=>
string(9) "getMethod"
["class"]=>
string(15) "ReflectionClass"
}
Reference: https://www.php.net/manual/en/reflectionclass.getmethod.php
Share your thoughts in the comments
Please Login to comment...