PHP | ReflectionMethod getModifiers() Function
Last Updated :
17 Dec, 2019
The ReflectionMethod::getModifiers() function is an inbuilt function in PHP which is used to return the numeric representation of the method modifiers.
Syntax:
int ReflectionMethod::getModifiers( void )
Parameters: This function does not accept any parameter.
Return Value: This function returns the numeric representation of the method modifiers.
Below programs illustrate the ReflectionMethod::getModifiers() function in PHP:
Program_1:
<?php
class Company {
protected function GeeksforGeeks( $name ) {
return 'GFG' . $name ;
}
}
$A = new ReflectionMethod( new Company(), 'GeeksforGeeks' );
$B = $A ->getModifiers();
var_dump( $B );
?>
|
Program_2:
<?php
class Department
{
final public static function Coding()
{
return ;
}
public function Marketing()
{
return ;
}
}
$A = new ReflectionMethod( 'Department' , 'Coding' );
$B = new ReflectionMethod( 'Department' , 'Marketing' );
var_dump( $A ->getModifiers());
var_dump( $B ->getModifiers());
?>
|
Output:
int(134217989)
int(134283520)
Reference: https://www.php.net/manual/en/reflectionmethod.getmodifiers.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...