PHP | ReflectionClass getReflectionConstants() Function Last Updated : 12 Jul, 2025 Summarize Comments Improve Suggest changes Share 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://www.php.net/manual/en/reflectionclass.getreflectionconstants.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getConstant() 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 Like