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// Declaring a class Testingclass Testing{ // Calling a function neveropen() with // two modifier named as public and static public static function neveropen() { return; }}// ReflectionMethod is called on the class Testing and// their member as function neveropen()$neveropen = new ReflectionMethod('Testing', 'neveropen');// Calling the getModifierNames() function and printing// an array of modifier namesecho implode(' ', Reflection::getModifierNames($neveropen->getModifiers()));?> |
public static
Program 2:
php
<?php// Declaring a class Testingclass Testing{ // Calling a function GFG() with // two modifier named as public and static final public function GFG() { return; }}// ReflectionMethod is called on the class Testing and// their member as function GFG()$GFG = new ReflectionMethod('Testing', 'GFG');// Calling the getModifierNames() function and printing// an array of modifier namesecho implode(' ', Reflection::getModifierNames($GFG->getModifiers()));?> |
final public
Reference: https://www.php.net/manual/en/reflection.getmodifiernames.php
