User Tools

Site Tools


uphp:functions:call_user_func

This is an old revision of the document!


call_user_func

WMPRO, WMMINI FW >= 1.0 WMMEGA FW >= 2.0

Call a user defined function with optional parameters

Description

mixed call_user_func ( string $function_name [, mixed $parameters ... ] )
Return result as defined by the user function

Parameters

function_name: String containing the name of the user function to call

parameters: Optional parameters to pass to the function

Return Value

Any type depending on the way the function is defined

Example

<? 
function my_add($x,$y) {
  return $x+$y;
}
$result=call_user_func("my_add",1,3);
print($result); //output will be '4'
?>

See Also

function - Define a function

return - Return program control to the calling module

Additional Information

User defined functions can take many different forms, and it is not necessary to use call_user_func() to execute a function unless a direct return value is needed.

If used within a function, the return statement immediately ends execution of the function, and returns its argument as the value of the function call.

uphp/functions/call_user_func.1488370764.txt.gz · Last modified: 2021/09/13 05:56 (external edit)