PHP | ReflectionClass getReflectionConstants() Function Last Updated : 30 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The ReflectionClass::getReflectionConstants() function is an inbuilt function in PHP which is used to return an array of ReflectionClassConstant objects. Syntax: array ReflectionClass::getReflectionConstants( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an array of ReflectionClassConstant objects. Below programs illustrate the ReflectionClass::getReflectionConstants() function in PHP: Program 1: php <?php // Declaring a class named as Company class Company { // Defining some constants const First = "GeeksforGeeks"; const Second = "GFG"; } // Using the ReflectionClass() function // over the Company class $A = new ReflectionClass('Company'); // Calling the getReflectionConstants() function $a = $A->getReflectionConstants(); // Getting an array of ReflectionClassConstant objects. print_r($a); ?> Output: Array ( [0] => ReflectionClassConstant Object ( [name] => First [class] => Company ) [1] => ReflectionClassConstant Object ( [name] => Second [class] => Company ) ) Program 2: php <?php // Using the ReflectionClass() function $A = new ReflectionClass('ReflectionClass'); // Calling the getReflectionConstants() function $a = $A->getReflectionConstants(); // Getting an array of ReflectionClassConstant objects. print_r($a); ?> Output: Array ( [0] => ReflectionClassConstant Object ( [name] => IS_IMPLICIT_ABSTRACT [class] => ReflectionClass ) [1] => ReflectionClassConstant Object ( [name] => IS_EXPLICIT_ABSTRACT [class] => ReflectionClass ) [2] => ReflectionClassConstant Object ( [name] => IS_FINAL [class] => ReflectionClass ) ) Reference: https://secure.php.net/manual/en/reflectionclass.getreflectionconstants.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getReflectionConstants() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass PHP- Reflection +1 More Similar Reads PHP | ReflectionClass getReflectionConstant() Function The ReflectionClass::getReflectionConstant() function is an inbuilt function in PHP which is used to return the ReflectionClassConstant of the specified class's property. Syntax: ReflectionClassConstant ReflectionClass::getReflectionConstant( string $name ) Parameters: This function accepts a single 2 min read PHP | ReflectionClass getConstants() Function The ReflectionClass::getConstants() function is an inbuilt function in PHP which is used to return an array of the specified constant names. Syntax: array ReflectionClass::getConstants( void ) Parameters: This function does not accept any parameter. Return Value: This function returns an array of th 2 min read PHP | ReflectionClass getConstant() Function The ReflectionClass::getConstant() function is an inbuilt function in PHP which is used to return the value of the defined constant. Syntax: mixed ReflectionClass::getConstant( string $name ) Parameters: This function accepts a parameter Name which is the name of the defined constant. Return Value: 1 min read PHP | ReflectionClass getConstructor() Function The ReflectionClass::getConstructor() function is an inbuilt function in PHP which is used to return the constructor of the specified class or NULL if the class is not having any constructor. Syntax: ReflectionMethod ReflectionClass::getConstructor( void ) Parameters: This function does not accept a 1 min read PHP | ReflectionClass getExtensionName() Function The ReflectionClass::getExtensionName() function is an inbuilt function in PHP which is used to return the name of the extension which define the class or false for user-defined classes.Syntax: string ReflectionClass::getExtensionName( void ) Parameters: This function does not accept any parameters. 1 min read PHP | ReflectionClass getFileName() Function The ReflectionClass::getFileName() function is an inbuilt function in PHP which is used to return the filename of the file in which the class has been defined or returns false if the file is not found. Syntax: string ReflectionClass::getFileName( void ) Parameters: This function does not accept any 1 min read PHP | ReflectionClass getParentClass() Function The ReflectionClass::getParentClass() function is an inbuilt function in PHP which is used to return the specified parent class or false if there is no parent class is present. Syntax: ReflectionClass ReflectionClass::getParentClass ( void ) Parameters: This function does not accept any parameters. 2 min read PHP | ReflectionClass hasConstant() Function The ReflectionClass::hasConstant() function is an inbuilt function in PHP which is used to check the specified constant is present or not. Syntax: bool ReflectionClass::hasConstant( string $name ) Parameters: This function accepts a single parameter $name which holds the name of the defined constant 1 min read PHP | ReflectionClass getTraitNames() Function The ReflectionClass::getTraitNames() function is an inbuilt function in PHP which is used to return an array of name of traits used by the user-defined class. Syntax: array ReflectionClass::getTraitNames( void ) Parameters: This function does not accept any parameters. Return Value: This function re 1 min read PHP | ReflectionClass getInterfaces() Function The ReflectionClass::getInterfaces() function is an inbuilt function in PHP which is used to return an associative array of interfaces. These returned array is containing keys as interface names and the array values as ReflectionClass objects. Syntax: array ReflectionClass::getInterfaces( void ) Par 2 min read Like