PHP | Reflection getNamespaceName() Function Last Updated : 17 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 specified namespace. Below programs illustrate the Reflection::getNamespaceName() function in PHP: Program 1: php <?php // Defining a namespace and class GFG namespace A\B; class GFG{ } // Using ReflectionClass over the namespace and // specified class GFG $ReflectionClass = new \ReflectionClass('A\\B\\GFG'); // Calling getNamespaceName() function $A = $ReflectionClass->getNamespaceName(); // Getting the name of the specified namespace var_dump($A); ?> Output: string(3) "A\B" Program 2: php <?php // Using ReflectionClass over the inbuilt class 'ReflectionClass' $ReflectionClass = new ReflectionClass('ReflectionClass'); // Calling getNamespaceName() function $A = $ReflectionClass->getNamespaceName(); // Getting the name of the namespace var_dump($A); ?> Output: string(0) "" Reference: https://www.php.net/manual/en/reflectionclass.getnamespacename.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass inNamespace() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass Similar Reads PHP | Reflection getName() Function 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 pr 1 min read 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 | ReflectionClass getInterfaceNames() Function The ReflectionClass::getInterfaceNames() function is an inbuilt function in PHP which is used to return an array of interface names as values. Syntax: array ReflectionClass::getInterfaceNames( void ) Parameters: This function does not accept any parameters. Return Value: This function returns an arr 1 min read PHP | ReflectionClass inNamespace() Function The ReflectionClass::inNamespace() function is an inbuilt function in PHP which is used to check the existence of the namespace. It returns true for the success or false on failure. Syntax: bool ReflectionClass::inNamespace( void ) Parameters: This function does not accept any parameters. Return Val 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 Like