PHP | ReflectionFunction invoke() Function Last Updated : 13 Dec, 2019 Comments Improve Suggest changes Like Article Like Report The ReflectionFunction::invoke() function is an inbuilt function in PHP which is used to return the result of the invoked function call. Syntax: mixed ReflectionFunction::invoke( mixed $args) Parameters: This function accept parameter $args which holds the list of arguments passed to the called function. Return Value: This function returns the result of the invoked function call. Below programs illustrate the ReflectionFunction::invoke() function in PHP: Program_1: php <?php // Initializing a user-defined function function Company($Company_Name, $Role) { return sprintf("%s %s\r\n", $Company_Name, $Role); } // Using ReflectionFunction() over the // specified function company $function = new ReflectionFunction('company'); // Calling the invoke() function $A = $function->invoke('GeeksforGeeks', 'is a Computer Science Portal.'); // Getting the result of the invoked function company echo $A; ?> Output: GeeksforGeeks is a Computer Science Portal. Program_2: php <?php // Initializing some user-defined functions function Trial1($First_Args, $Second_Args) { return sprintf("%s %s\r\n", $First_Args, $Second_Args); } function Trial2($First_Args, $Second_Args) { return sprintf("%s %s\r\n", $First_Args, $Second_Args); } // Using ReflectionFunction() over the above // specified functions $function = new ReflectionFunction('Trial1'); $function = new ReflectionFunction('Trial2'); // Calling the invoke() function and getting the // result of the invoked function company echo $function->invoke('a+a', '= 2a'); echo $function->invoke('a*a', '= a^2'); ?> Output: a+a = 2a a*a = a^2 Reference: https://www.php.net/manual/en/reflectionfunction.invoke.php Comment More infoAdvertise with us Next Article PHP | ReflectionFunction invoke() Function K Kanchan_Ray Follow Improve Article Tags : Web Technologies PHP PHP-function PHP- Reflection Similar Reads PHP | ReflectionFunction invokeArgs() Function The ReflectionFunction::invokeArgs() function is an inbuilt function in PHP which is used to return the result of the invoked function call. Syntax: mixed ReflectionFunction::invokeArgs( array $args ) Parameters: This function accepts a single parameter $args which holds the array of arguments passe 2 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 | ReflectionExtension info() Function The ReflectionExtension::info() function is an inbuilt function in PHP which is used to return the information of the specified extension. Syntax: void ReflectionExtension::info( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the information of th 1 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 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 | ReflectionFunction __toString() Function The ReflectionFunction::__toString() function is an inbuilt function in PHP which is used to return the string representation of the specified function.Syntax: string ReflectionFunction::__toString( void ) Parameters: This function does not accept any parameters.Return Value: This function returns t 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 | 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 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 | 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 Like