array Reflection::getModifierNames (int $modifiers)Parameters:This function accepts $modifiers withone parameter ,which is a modifier bitfield. Here, the bitfield is a data structure consisting of several contiguous regions of the computer’s memory.Returned value:This function returns an array of the specified modifier names.Below the program illustrate the Reflection::getModifierNames() function in PHP:
Program 1:
php
// Testing class declaration
class
Testing
{
// Call the GeeksforGeeks() function c
// two modifiers named public and static
public
static
function
GeeksforGeeks()
{
return
;
}
}
// ReflectionMethod is called for the Testing class and
// their member as a GeeksforGeeks() function
$GeeksforGeeks
=
new
ReflectionMethod (
’Testing’
,
’GeeksforGeeks’
);
// Call the getModifierNames() function and print
// array of modifier names
echo
implode (
’’
, Reflection::getModifierNames (
$GeeksforGeeks
-> getModifiers()));
?>
Output: public static
Program 2: php
// Testing class declaration
class
Testing
{
// Calling the GFG() function with
// two modifiers named public and static
final
public
function
GFG()
{
return
;
}
}
// ReflectionMethod is called for the Testing class and
// their member as a GFG() function
$GFG
=
new
ReflectionMethod (
’Testing’
,
’GFG’
);
// Call the getModifierNames() function and print
// array of modifier names
echo
implode (
’’
, Reflection::getModifierNames (
$GFG
-> getModifiers()));
?>
Output: final public
Link: https://www.php.net/manual/en/reflection.getmodifiernames.php