PHP | Reflection getModifiers() Function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The Reflection::getModifiers() function is an inbuilt function in PHP which is used to return an array of the specified modifier names. Syntax: int Reflection::getModifiers( void ) Parameters: This function does not accept any parameters. Return Value: This function returns a bitfield of the access modifiers for the specified class. Below programs illustrate the Reflection::getModifiers() function in PHP: Program 1: php <?php // Declaring a class Testing class Testing { // Calling a function GeeksforGeeks() with // two modifier named as public and static public static function GeeksforGeeks() { return; } } // ReflectionMethod is called on the class Testing and // their member as function GeeksforGeeks() $GeeksforGeeks = new ReflectionMethod('Testing', 'GeeksforGeeks'); // Calling the getModifiers() function and printing // an array of modifiers echo implode(' ', Reflection::getModifierNames( $GeeksforGeeks->getModifiers())); ?> Output: public static Program 2: php <?php // Declaring a class Departments class Departments { // Calling some function with // different modifiers public function IT() { return; } final public function CSE() { return; } private function ECE() { return; } } // ReflectionMethod is called on the above class // with their members $A = new ReflectionMethod('Departments', 'IT'); $B = new ReflectionMethod('Departments', 'CSE'); $C = new ReflectionMethod('Departments', 'ECE'); // Calling the getModifiers() function and printing // an array of modifiers echo implode(' ', Reflection::getModifierNames( $A->getModifiers())). "\n"; echo implode(' ', Reflection::getModifierNames( $B->getModifiers())). "\n"; echo implode(' ', Reflection::getModifierNames( $C->getModifiers())). "\n"; ?> Output: public final public private Reference: https://www.php.net/manual/en/reflectionclass.getmodifiers.php Comment More infoAdvertise with us Next Article PHP | Reflection getName() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass Similar Reads PHP | Reflection getModifierNames() Function 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. H 2 min read PHP | ReflectionMethod getModifiers() Function 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 1 min read PHP | ReflectionProperty getModifiers() Function The ReflectionProperty::getModifiers() function is an inbuilt function in PHP which is used to return the numeric representation of the specified modifiers. Syntax: int ReflectionProperty::getModifiers ( void ) Parameters: This function does not accept any parameters. Return Value: This function ret 2 min read PHP | Reflection getName() Function The Reflection::getName() function is an inbuilt function in PHP which is used to return the name of the specified class. Syntax: string Reflection::getName( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the name of the specified class. Below pr 1 min read PHP ReflectionClass getMethods() Function The ReflectionClass::getMethods() function is an inbuilt function in PHP which is used to return an array of specified methods.Syntax: array ReflectionClass::getMethods( int $filter )Parameters: This function accepts a single parameter filter which is used to remove some of the methods.Return Value: 2 min read PHP | ReflectionClass getMethod() Function 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 1 min read Like