PHP | Reflection getName() Function Last Updated : 30 Nov, 2019 Comments Improve Suggest changes Like Article Like Report The Reflection::getName() function is an inbuilt function in PHP which is used to return the name of the specified class. Syntax: string Reflection::getName( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the name of the specified class. Below programs illustrate the Reflection::getName() function in PHP: Program 1: php <?php // Defining a user-defined class named as Departments class Departments { public $Dept1 = 'CSE'; private $Dept2 = 'ECE'; public static $Dept3 = 'EE'; } // Using ReflectionClass over the class Departments $ReflectionClass = new ReflectionClass('Departments'); // Calling getName() function $A = $ReflectionClass->getName(); // Getting the name of the specified class var_dump($A); ?> Output: string(11) "Departments" Program 2: php <?php // Using ReflectionClass over the inbuilt class 'ReflectionClass' $ReflectionClass = new ReflectionClass('ReflectionClass'); // Calling getName() function $A = $ReflectionClass->getName(); // Getting the name of the class var_dump($A); ?> Output: string(15) "ReflectionClass" Reference: https://www.php.net/manual/en/reflectionclass.getname.php Comment More infoAdvertise with us Next Article PHP | Reflection getName() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass PHP- Reflection +1 More Similar Reads PHP | Reflection getShortName() Function The Reflection::getShortName() function is an inbuilt function in PHP which is used to return the short name of the specified class, the part without the namespace. Syntax: string Reflection::getShortName( void ) Parameters: This function does not accept any parameters. Return Value: This function r 1 min read PHP | ReflectionProperty getName() Function The ReflectionProperty::getName() function is an inbuilt function in PHP which is used to return the name of the specified property. Syntax: string ReflectionProperty::getName ( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the name of the speci 1 min read PHP | Reflection getNamespaceName() Function The Reflection::getNamespaceName() function is an inbuilt function in PHP which is used to return the name of the specified namespace. Syntax: string Reflection::getNamespaceName( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the name of the spe 1 min read PHP | ReflectionParameter getName() Function The ReflectionParameter::getName() function is an inbuilt function in PHP which is used to return the name of the specified parameter. Syntax: string ReflectionParameter::getName ( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the name of the sp 2 min read PHP | ReflectionExtension getName() Function The ReflectionExtension::getName() function is an inbuilt function in PHP which is used to return the name of the specified extension. Syntax: string ReflectionExtension::getName( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the name of the spec 1 min read PHP | Reflection getModifierNames() Function The Reflection::getModifierNames() function is an inbuilt function in PHP which is used to return an array of the specified modifier names. Syntax: array Reflection::getModifierNames( int $modifiers ) Parameters: This function accepts single parameter $modifiers which is Bitfield of the modifiers. H 2 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 | Reflection getModifiers() Function The Reflection::getModifiers() function is an inbuilt function in PHP which is used to return an array of the specified modifier names. Syntax: int Reflection::getModifiers( void ) Parameters: This function does not accept any parameters. Return Value: This function returns a bitfield of the access 2 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 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 Like