This shows you the differences between two versions of the page.
uphp:functions:function_exists [2017/04/13 07:15] jeff |
uphp:functions:function_exists [2021/09/13 05:57] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ======function_exists====== | ||
- | |||
- | < | ||
- | |||
- | Check if a function exists (native or custom) | ||
- | |||
- | ====Description==== | ||
- | |||
- | <well size=" | ||
- | < | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | [[function_exists]] ( | ||
- | < | ||
- | <span style=" | ||
- | <span style=" | ||
- | <span style=" | ||
- | </ | ||
- | </ | ||
- | |||
- | This function will check to see if a function exists in firmware (native, internal) or has been defined in the current script context (custom, user-defined). | ||
- | |||
- | ====Parameter==== | ||
- | |||
- | < | ||
- | |||
- | ====Return Value==== | ||
- | |||
- | < | ||
- | |||
- | ====Examples==== | ||
- | |||
- | ===Check for the existence of the ' | ||
- | |||
- | <code php> | ||
- | <? | ||
- | $f=" | ||
- | if (function_exists(" | ||
- | print(" | ||
- | } else { | ||
- | print(" | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | |||
- | ===Load a list of custom functions and check that a function is included before calling it=== | ||
- | |||
- | <code php> | ||
- | <? | ||
- | include("/ | ||
- | | ||
- | $f=" | ||
- | if (function_exists($f)) { | ||
- | print(call_user_func($f, | ||
- | } else { | ||
- | print(" | ||
- | die(); | ||
- | } | ||
- | ?> | ||
- | </ | ||
- | |||
- | ====See Also==== | ||
- | |||
- | [[phpinfo()]] - Return information about the system [including the Firmware Version] | ||
- | |||
- | [[include()]] - Include a file within the current script at the current location | ||
- | |||
- | [[call_user_func()]] - Call a user defined function with optional parameters | ||
- | |||
- | [[uphp: | ||