PHP | Reflection getModifierNames() Function
Last Updated :
23 Aug, 2021
The Reflection::getModifierNames() function is an inbuilt function in PHP which is used to return an array of the specified modifier names.
Syntax:
array Reflection::getModifierNames( int $modifiers )
Parameters: This function accepts single parameter $modifiers which is Bitfield of the modifiers. Here the bitfield is a data structure consisting of a number of adjacent computer memory locations.
Return Value: This function returns an array of the specified modifier names.
Below programs illustrate the Reflection::getModifierNames() function in PHP:
Program 1:
php
<?php
class Testing
{
public static function GeeksforGeeks()
{
return ;
}
}
$GeeksforGeeks = new ReflectionMethod( 'Testing' , 'GeeksforGeeks' );
echo implode( ' ' , Reflection::getModifierNames( $GeeksforGeeks ->getModifiers()));
?>
|
Program 2:
php
<?php
class Testing
{
final public function GFG()
{
return ;
}
}
$GFG = new ReflectionMethod( 'Testing' , 'GFG' );
echo implode( ' ' , Reflection::getModifierNames( $GFG ->getModifiers()));
?>
|
Reference: https://www.php.net/manual/en/reflection.getmodifiernames.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...