PHP | ReflectionMethod export() Function Last Updated : 28 Nov, 2022 Comments Improve Suggest changes Like Article Like Report The ReflectionMethod::export() function is an inbuilt function in PHP which is used to return the export as a string if the return parameter has been set to TRUE, otherwise NULL is returned. Syntax: string ReflectionMethod::export ( $class, $name, $return ) Parameters: This function accepts three parameters as mentioned above and described below: class: This is the name of the initialized class.name: This is the name of the method.return: It's value is either TRUE or FALSE. Using TRUE will return the export whereas using FALSE will do the opposite. Return Value: This function returns the export as a string if the return parameter has been set to TRUE, otherwise NULL is returned. Below programs illustrate the ReflectionMethod::export() function in PHP: Program_1: php <?php // Initializing a user-defined class class Company { protected function GeeksforGeeks($name) { return 'GFG' . $name; } } // Using ReflectionMethod() over the class Company $A = new ReflectionMethod(new Company(), 'GeeksforGeeks'); // Calling the export() function $B = $A->export( 'Company', 'GeeksforGeeks', $return = TRUE ); // Getting the export as a string if the // return parameter has been set to TRUE, // otherwise NULL is returned. var_dump($B); ?> Output: string(171) "Method [ <user> protected method GeeksforGeeks ] { @@ /home/cd1a603457d3beda20350155354b4363.php 6 - 8 - Parameters [1] { Parameter #0 [ <required> $name ] } } " Program_2: php <?php // Initializing some user-defined classes class Department1 { protected function HR($name) { return 'hr' . $name; } } class Department2 { protected function Coding($name) { return 'coding' . $name; } } class Department3 { protected function Marketing($name) { return 'marketing' . $name; } } // Using ReflectionMethod() over the above classes $A = new ReflectionMethod(new Department1(), 'HR'); $B = new ReflectionMethod(new Department2(), 'Coding'); $C = new ReflectionMethod(new Department3(), 'Marketing'); // Calling the export() function and // Getting the export as a string if the // return parameter has been set to TRUE, // otherwise NULL is returned. var_dump($A->export( 'Department1', 'HR', $return = TRUE )); var_dump($B->export( 'Department2', 'Coding', $return = FALSE )); var_dump($C->export( 'Department3', 'Marketing', $return = FALSE )); ?> Output: string(160) "Method [ <user> protected method HR ] { @@ /home/b1fa43e2f382f32d60abd4370db4a4f6.php 6 - 8 - Parameters [1] { Parameter #0 [ <required> $name ] } } " Method [ <user> protected method Coding ] { @@ /home/b1fa43e2f382f32d60abd4370db4a4f6.php 12 - 14 - Parameters [1] { Parameter #0 [ <required> $name ] } } NULL Method [ <user> protected method Marketing ] { @@ /home/b1fa43e2f382f32d60abd4370db4a4f6.php 18 - 20 - Parameters [1] { Parameter #0 [ <required> $name ] } } NULL Reference: https://www.php.net/manual/en/reflectionmethod.export.php Comment More infoAdvertise with us Next Article PHP | ReflectionMethod export() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- Reflection Similar Reads PHP | ReflectionExtension export() Function The ReflectionExtension::export() function is an inbuilt function in PHP which is used to return the export as a string if the return parameter is set to TRUE, otherwise NULL is returned. Syntax: string ReflectionExtension::export( string $name, string $return ) Parameters: This function accepts two 2 min read PHP ReflectionFunction export() Function The ReflectionFunction::export() function is an inbuilt function in PHP which is used to return the export as a string if the return parameter is set to TRUE, otherwise NULL is returned. Syntax: string ReflectionFunction::export( string $name, string $return ) Parameters: This function accepts two p 2 min read PHP | ReflectionClass export() Function The ReflectionClass::export() function is an inbuilt function in PHP which is used to return a string if the parameter has been set to TRUE, otherwise return NULL. Syntax: string ReflectionClass::export( mixed $argument, bool $return = FALSE) Parameters: This function accepts two parameters as menti 6 min read PHP | ReflectionMethod invoke() Function The ReflectionMethod::invoke() function is an inbuilt function in PHP which is used to invoke the specified reflected method and returns the result of the method.Syntax: public mixed ReflectionMethod::invoke ( $object, $parameter ) Parameters: This function accepts two parameters which are illustrat 2 min read PHP | ReflectionMethod isFinal() Function The ReflectionMethod::isFinal() function is an inbuilt function in PHP which is used to return TRUE if the specified method is final, otherwise returns FALSE. Syntax: bool ReflectionMethod::isFinal( void ) Parameters: This function does not accept any parameters. Return Value: This function returns 2 min read PHP | ReflectionMethod __toString() Function The ReflectionMethod::__toString() function is an inbuilt function in PHP which is used to return the string representation of the specified method object. Syntax: string ReflectionMethod::__toString ( void ) Parameters: This function does not accept any parameter. Return Value: This function return 2 min read PHP | ReflectionMethod isPublic() Function The ReflectionMethod::isPublic() function is an inbuilt function in PHP which is used to return TRUE if the specified method is public, otherwise FALSE. Syntax: bool ReflectionMethod::isPublic ( void ) Parameters: This function does not accept any parameter. Return Value: This function returns TRUE 2 min read PHP | ReflectionMethod isStatic() Function The ReflectionMethod::isStatic() function is an inbuilt function in PHP which is used to return TRUE if the specified method is static, otherwise FALSE. Syntax: public bool ReflectionMethod::isStatic ( void ) Parameters: This function does not accept any parameter. Return Value: This function return 2 min read PHP | ReflectionMethod isPrivate() Function The ReflectionMethod::isPrivate() function is an inbuilt function in PHP which is used to return TRUE if the specified method is private, otherwise returns FALSE. Syntax: bool ReflectionMethod::isPrivate( void ) Parameters: This function does not accept any parameters. Return Value: This function re 2 min read PHP | ReflectionMethod invokeArgs() Function The ReflectionMethod::invokeArgs() function is an inbuilt function in PHP which is used to invoke the specified reflected method and returns the result of the method.Syntax: mixed ReflectionMethod::invokeArgs ( $object, $parameter ) Parameters: This function accepts two parameters as mentioned above 2 min read Like