PHP | ReflectionClass getProperty() Function Last Updated : 30 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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. Return Value: This function returns an array of the ReflectionProperty for the specified class. Below programs illustrate the ReflectionClass::getProperty() function in PHP: Program 1: php <?php // Using ReflectionClass $ReflectionClass = new ReflectionClass('ReflectionClass'); // Initialising a property name $a = 'name'; // Calling getProperty() function over // the property name $Property = $ReflectionClass->getProperty($a); // Getting an array of the ReflectionProperty // for the specified class. var_dump($Property); ?> Output: object(ReflectionProperty)#2 (2) { ["name"]=> string(4) "name" ["class"]=> string(15) "ReflectionClass" } Program 2: php <?php // Defining a class named as Company class Company { public $C1; private $C2; public static $C3; } // Using ReflectionClass over the class Company $ReflectionClass = new ReflectionClass('Company'); // Calling getPropertY() function $A = $ReflectionClass->getProperty('C1'); // Getting an array of the reflected property var_dump($A); ?> Output: object(ReflectionProperty)#2 (2) { ["name"]=> string(2) "C1" ["class"]=> string(7) "Company" } Reference: https://www.php.net/manual/en/reflectionclass.getproperties.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getProperty() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass PHP- Reflection +1 More Similar Reads PHP | ReflectionClass getProperties() Function The ReflectionClass::getProperties() function is an inbuilt function in PHP which is used to return an array of the reflected properties. Syntax: ReflectionClass::getProperties($filter) : array Parameters: This function accepts a parameter filter which helps to remove some of the reflected propertie 2 min read PHP | ReflectionClass getStaticProperties() Function The ReflectionClass::getStaticProperties() function is an inbuilt function in PHP which is used to return an array of the static properties. This function is not documented currently, but its argument list is available. Syntax: ReflectionClass::getStaticProperties(void) : array Parameters: This func 1 min read PHP | ReflectionClass getDefaultProperties() Function The ReflectionClass::getDefaultProperties() function is an inbuilt function in PHP which is used to return the default properties including inherited properties from a specified class. Syntax: ReflectionClass::getDefaultProperties(void) : array Parameters: This function does not accept any parameter 2 min read PHP | ReflectionClass getStaticPropertyValue() Function The ReflectionClass::getStaticPropertyValue() function is an inbuilt function in PHP which is used to return the value of the static property. Syntax: mixed ReflectionClass::getStaticPropertyValue( string $name, mixed &$def_value ) Parameters: This function accepts a single parameter name which is t 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 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 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 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 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 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 Like