PHP | ReflectionClass inNamespace() Function Last Updated : 17 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 Value: This function returns true for the success or false on failure. Below programs illustrate the ReflectionClass::inNamespace() 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 inNamespace() function $A = $ReflectionClass->inNamespace(); // Getting the value true or false var_dump($A); ?> Output: bool(true) Program 2: php <?php // Using ReflectionClass over the inbuilt // class 'stdClass' $ReflectionClass = new ReflectionClass('stdClass'); // Calling inNamespace() function $A = $ReflectionClass->inNamespace(); // Getting the value true or false var_dump($A); ?> Output: bool(false) Reference: https://www.php.net/manual/en/reflectionclass.innamespace.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getFileName() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- ReflectionClass Similar Reads PHP | ReflectionClass isInstance() Function The ReflectionClass::isInstance() function is an inbuilt function in PHP which is used to check whether the specified object is an instance of the class or not. Syntax: bool ReflectionClass::isInstance( object $object ) Parameters: This function accepts a single parameter object which is being searc 1 min read PHP | ReflectionClass isInterface() Function The ReflectionClass::isInterface() function is an inbuilt function in PHP which is used to check the specified class is an interface or not. Syntax: bool ReflectionClass::isInterface( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the spe 1 min read PHP | ReflectionClass isAbstract() Function The ReflectionClass::isAbstract() function is an inbuilt function in PHP which is used to check the specified class is abstract or not. Syntax: bool ReflectionClass::isAbstract( void ) Parameters: This function does not accept any parameters. Return Value: This function returns true for the success 1 min read PHP | ReflectionClass getInterfaces() Function The ReflectionClass::getInterfaces() function is an inbuilt function in PHP which is used to return an associative array of interfaces. These returned array is containing keys as interface names and the array values as ReflectionClass objects. Syntax: array ReflectionClass::getInterfaces( void ) Par 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 | 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 Like