PHP | ReflectionClass getConstructor() Function Last Updated : 30 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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 any parameter. Return Value: This function returns the constructor of the specified class or NULL if the class is not having any constructor. Below programs illustrate the ReflectionClass::getConstructor() function in PHP: Program 1: php <?php // Using ReflectionClass over the class named as ReflectionClass $Class = new ReflectionClass('ReflectionClass'); // Calling the getConstructor() function $constructor = $Class->getConstructor(); // Getting the constructor for the defined Class var_dump($constructor); ?> Output: object(ReflectionMethod)#2 (2) { ["name"]=> string(11) "__construct" ["class"]=> string(15) "ReflectionClass" } Program 2: php // Defining a user-defined class Company class Company { public function GeeksforGeeks() { } static function gfg() { } } // Using ReflectionClass over the class Company $A = new ReflectionClass("Company"); // Calling the getConstructor() function $B = $A->getConstructor(); // Getting the constructor for the defined Class // or NULL if the constructor is not present var_dump($B); ?> Output: NULL Reference: https://www.php.net/manual/en/reflectionclass.getconstructor.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getConstructor() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass PHP- Reflection +1 More Similar Reads 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 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 getStartLine() Function The ReflectionClass::getStartLine() function is an inbuilt function in PHP which is used to return the line number from where the user defined class get started. Syntax: int ReflectionClass::getStartLine( 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 PHP | ReflectionClass getDocComment() Function The ReflectionClass::getDocComment() function is an inbuilt function in PHP which is used to return the specified doc comments if it exists, otherwise returns false. Syntax: string ReflectionClass::getDocComment( void ) Parameters: This function does not accept any parameters.Return Value: This func 1 min read PHP | ReflectionClass getProperty() Function The ReflectionClass::getProperty() function is an inbuilt function in PHP which is used to return an array of the ReflectionProperty for the specified class. Syntax: ReflectionClass::getProperty ( string $name ) : array Parameters: This function accepts a parameter name which is name of the property 1 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 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 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 Like