This shows you the differences between two versions of the page.
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/03/18 18:08] jeff |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======call_user_function====== | + | ======call_user_func====== |
- | < | + | < |
Call a user defined function with optional parameters | Call a user defined function with optional parameters | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | <well size=" |
+ | <span style=" | ||
+ | < | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | </ | ||
Return result as defined by the user function | Return result as defined by the user function | ||
====Parameters==== | ====Parameters==== | ||
- | < | + | < |
- | < | + | < |
====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><? | + | <code php> |
- | function my_add($x, | + | <? |
- | return $x+$y; | + | function my_add($x, |
- | } | + | return $x+$y; |
- | $result=call_user_func(" | + | } |
- | print($result); | + | $result=call_user_func(" |
- | ?></ | + | print($result); |
- | + | ?> | |
- | ====Additional Information==== | + | </ |
- | If called from within a function, the [[uphp: | + | |
====See Also==== | ====See Also==== | ||
+ | [[uphp: | ||
+ | |||
[[uphp: | [[uphp: | ||
- | [[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, |