This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
uphp:functions:call_user_func [2017/02/20 15:33] jeff |
uphp:functions:call_user_func [2017/04/06 14:54] jeff |
||
---|---|---|---|
Line 1: | Line 1: | ||
======call_user_func====== | ======call_user_func====== | ||
- | < | + | |
+ | < | ||
Call a user defined function with optional parameters | Call a user defined function with optional parameters | ||
====Description==== | ====Description==== | ||
- | <well size=" | + | |
- | <span style=" | + | <well size=" |
- | < | + | < |
- | <span style=" | + | <span style=" |
- | <span style=" | + | <span style=" |
- | <span style=" | + | </ |
- | <span style=" | + | [[call_user_func]] |
- | <span style=" | + | < |
- | <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==== | ||
- | < | ||
- | < | + | <html><b>< |
+ | |||
+ | < | ||
====Return Value==== | ====Return Value==== | ||
+ | |||
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, | + | <code php> |
- | return $x+$y; | + | <? |
- | } | + | function my_add($x, |
- | $result=call_user_func(" | + | return $x+$y; |
- | print($result); | + | } |
- | ?></ | + | $result=call_user_func(" |
+ | print($result); | ||
+ | ?> | ||
+ | </ | ||
====See Also==== | ====See Also==== | ||
+ | |||
+ | [[function_exists()]] - Check if a function exists (native or custom) | ||
+ | |||
[[uphp: | [[uphp: | ||
Line 40: | Line 56: | ||
====Additional Information==== | ====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. | 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: | If used within a function, the [[uphp: | ||
+ |