User Tools

Site Tools


uphp:functions:call_user_func

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revision Both sides next revision
uphp:functions:call_user_func [2017/02/18 12:47]
jeff created
uphp:functions:call_user_func [2017/04/06 14:54]
jeff
Line 1: Line 1:
-======call_user_function====== +======call_user_func====== 
-<badge>WMPRO, WMMINI FW > 1.0</badge> <badge>WMMEGA FW > 2.0</badge>+ 
 +<badge>WMPRO, WMMINI FW >1.0</badge> <badge>WMMEGA FW >2.0</badge>
  
 Call a user defined function with optional parameters Call a user defined function with optional parameters
  
 ====Description==== ====Description====
-<well size="sm"><html><span style="font-size:125%;color:green;">mixed <span style="color:black;"></html>[[call_user_function]]<html> <span style="color:green;">string <span style="color:blue;">$function_name <span style="color:black;">[, <span style="color:green;">mixed <span style="color:blue;">$parameters <span style="color:black;">... ] )</html></well>+ 
 +<well size="sm"> 
 +<html> 
 +<span style="font-size:125%;color:green">mixed 
 +<span style="color:black"> 
 +</html> 
 +[[call_user_func]] 
 +<html> 
 +<span style="color:green">string 
 +<span style="color:blue">$function_name 
 +<span style="color:black">[, 
 +<span style="color:green">mixed 
 +<span style="color:blue">$parameters 
 +<span style="color:black">... ] ) 
 +</html> 
 +</well> 
 Return result as defined by the user function  Return result as defined by the user function 
  
 ====Parameters==== ====Parameters====
-<html><span style="color:blue;"><b>function_name</b><span style="color:black;"></html>: String containing the name of the user function to call 
  
-<html><span style="color:blue;"><b>parameters</b><span style="color:black;"></html>: Optional parameters to pass to the function+<html><b><span style="color:blue">$function_name<span style="color:black"></b></html>:  <html><b><span style="color:green">String<span style="color:black"></b></html> containing the name of the user function to call 
 + 
 +<html><b><span style="color:blue">$parameters<span style="color:black"></b></html>:  Optional parameter(s) to pass to the function
  
 ====Return Value==== ====Return Value====
-The result of the function can be of any type depending on the way the function is defined+ 
 +Any type depending on the way the function is defined
  
 ====Example==== ====Example====
-<code php><?  
-function my_add($x,$y) { 
-  return $x+$y; 
-} 
-$result=call_user_func("my_add",1,3); 
-print($result); // result is 4 
-?></code> 
  
-====Additional Information==== +<code php> 
-If called from within a function, the [[uphp:statements:return]] statement immediately ends execution of the current functionand returns its argument as the value of the function call.+<? 
 +  function my_add($x,$y) { 
 +    return $x+$y; 
 +  } 
 +  $result=call_user_func("my_add",1,3); 
 +  print($result); // result is 4 
 +?> 
 +</code>
  
 ====See Also==== ====See Also====
 +
 +[[function_exists()]] - Check if a function exists (native or custom)
 +
 +[[uphp:statements:function]] - Define a function
 +
 [[uphp:statements:return]] - Return program control to the calling module [[uphp:statements:return]] - Return program control to the calling module
  
-[[print()]] - Output data to the current output stream such as a web page or terminal+====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 [[uphp:statements:return]] statement immediately ends execution of the function, and returns its argument as the value of the function call. 
uphp/functions/call_user_func.txt · Last modified: 2021/09/13 05:57 (external edit)