PHP | Reflection getName() Function Last Updated : 30 Nov, 2019 Summarize Comments Improve Suggest changes Share 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 | ReflectionParameter 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 Like