PHP | ReflectionClass getFileName() Function Last Updated : 26 Nov, 2019 Comments Improve Suggest changes Like Article Like Report 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 parameters. Return Value: This function returns the filename of the file in which the class has been defined or returns false if the file is not found. Below programs illustrate the ReflectionClass::getFileName() function in PHP: Program 1: php <?php // Defining a user-defined class // named as Departments class Departments { static $Dept1 = 'CSE'; private static $Dept2 = 'ECE'; public static $Dept3 = 'EE'; } // Using ReflectionClass over the class Departments $ReflectionClass = new ReflectionClass('Departments'); // Calling getFileName() functions $A = $ReflectionClass->getFileName(); // Getting the name of the file // in which the class has been defined var_dump($A); ?> Output: string(23) "C:\xampp\htdocs\gfg.php" Program 2: php <?php // Using ReflectionClass $ReflectionClass = new ReflectionClass('ReflectionClass'); // Calling getFileName() functions $A = $ReflectionClass->getFileName(); // Getting the name of the file // in which the class has been defined var_dump($A); ?> Output: bool(false) Reference: https://www.php.net/manual/en/reflectionclass.getfilename.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass getFileName() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 getEndLine() Function The ReflectionClass::getEndLine() function is an inbuilt function in PHP which is used to return the line number where the user defined class get ends. Syntax: int ReflectionClass::getEndLine( void ) Parameters: This function does not accept any parameters. Return Value: This function returns the li 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 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 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 PHP | ReflectionClass getExtensionName() Function The ReflectionClass::getExtensionName() function is an inbuilt function in PHP which is used to return the name of the extension which define the class or false for user-defined classes.Syntax: string ReflectionClass::getExtensionName( void ) Parameters: This function does not accept any parameters. 1 min read 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 | ReflectionClass isFinal() Function The ReflectionClass::isFinal() function is an inbuilt function in PHP which is used to check the specified class is final or not. Syntax: bool ReflectionClass::isFinal( void ) Parameters: This function does not accept any parameters. Return Value: This function returns true for the success or false 1 min read PHP | ReflectionClass getTraitAliases() Function The ReflectionClass::getTraitAliases() function is an inbuilt function in PHP which is used to return an array of trait aliases used by the user-defined class.Syntax: array ReflectionClass::getTraitAliases( void ) Parameters: This function does not accept any parameters.Return Value: This function r 1 min read PHP | ReflectionClass getStartLine() Function The ReflectionClass::getStartLine() function is an inbuilt function in PHP which is used to return the line number from where the user defined class get started. Syntax: int ReflectionClass::getStartLine( void ) Parameters: This function does not accept any parameters. Return Value: This function re 1 min read Like