PHP ReflectionClass hasProperty() Function Last Updated : 22 Feb, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The ReflectionClass hasProperty() function is an inbuilt function in PHP that is used to check the specified property is present or not. Syntax: bool ReflectionClass hasProperty( string $name ) Parameters: This function accepts a single parameter $name which holds the name of the property that is being checked.Return Value: This function returns true if the specified property is present, otherwise returns false.Below programs illustrate the ReflectionClass hasProperty() function in PHP: Program 1: php <?php // Using ReflectionClass $ReflectionClass = new ReflectionClass('ReflectionClass'); // Initializing a property name $a = 'name'; // Calling hasProperty() function over // the property name $Property = $ReflectionClass->hasProperty($a); // Getting the value true or false var_dump($Property); ?> Output: bool(true) Program 2: php <?php // Defining a user-defined class Company class Company { Public Function GeeksforGeeks() {} Private Function GFG() {} } // Using ReflectionClass over the above // Company class $Class = new ReflectionClass('Company'); // Calling hasProperty() function $A = $Class->hasProperty($Class); // Getting the value either true or false var_dump($A); ?> Output: bool(false) Reference: https://www.php.net/manual/en/reflectionclass.hasproperty.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 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 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 hasMethod() Function The ReflectionClass::hasMethod() function is an inbuilt function in PHP which is used to check the specified method is present or not.Syntax: bool ReflectionClass::hasMethod( string $name ) Parameters: This function accepts a single parameter $name which holds the name of the method which are being 1 min read PHP | ReflectionClass hasMethod() Function The ReflectionClass::hasMethod() function is an inbuilt function in PHP which is used to check the specified method is present or not.Syntax: bool ReflectionClass::hasMethod( string $name ) Parameters: This function accepts a single parameter $name which holds the name of the method which are being 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 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 Like