PHP ReflectionFunction export() Function Last Updated : 26 May, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 parameters as mentioned above and described below: $name: It is the specified function which is to be exported.$return: It is the Boolean value either TRUE or FALSE. If its value is set to True then it will export and if its value is set to false then it will return NULL. False is the default value. Return Value: This function returns the export as a string if the return parameter is set to TRUE, otherwise NULL is returned. Below programs illustrate the ReflectionFunction::export() 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 export() function $A = $function->export(Company, $return = TRUE); // Getting the export as a string echo $A; ?> Output:Function [ <user> function Company ] { @@ /home/b38c7d194c961e6b0d1d5b1c6e582d19.php 4 - 7 - Parameters [2] { Parameter #0 [ <required> $Company_Name ] Parameter #1 [ <required> $Role ] } } 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 $function1 = new ReflectionFunction('Trial1'); $function2 = new ReflectionFunction('Trial2'); // Calling the export() function and // Getting the export as a string echo $function1->export(Trial1, $return = TRUE); echo $function2->export(Trial2, $return = FALSE); ?> Output:Function [ <user> function Trial1 ] { @@ /home/2410abe3ca2b5235249f9a0c9ba035b4.php 4 - 7 - Parameters [2] { Parameter #0 [ <required> $First_Args ] Parameter #1 [ <required> $Second_Args ] } } Function [ <user> function Trial2 ] { @@ /home/2410abe3ca2b5235249f9a0c9ba035b4.php 9 - 12 - Parameters [2] { Parameter #0 [ <required> $First_Args ] Parameter #1 [ <required> $Second_Args ] } } Reference: https://www.php.net/manual/en/reflectionfunction.export.php Comment More infoAdvertise with us Next Article PHP | ReflectionClass 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 | ReflectionMethod export() Function 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 pa 3 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 | ReflectionExtension getFunctions() Function The ReflectionExtension::getFunctions() function is an inbuilt function in PHP which is used to return extension functions from the specified extension. Syntax: array ReflectionExtension::getFunctions( void ) Parameters: This function does not accept any parameter. Return Value: This function return 2 min read PHP | var_export() Function The var_export() is a built-in function in PHP which is used to return the structured value(information) of a variable that is passed to this function as a parameter. This function is similar to the var_dump() function.Syntax: var_export($var, $return) Parameters: This function accepts two parameter 1 min read PHP | SplFileObject eof() Function The SplFileObject::eof() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used reached end of file. Syntax: string SplFileObject::eof( void ) Parameters: This function does not accept any parameter. Return values: Returns TRUE on Success. Below Programs illustrate the Sp 1 min read Like