WMPRO, WMMINI FW >= 1.887 WMMEGA FW >= 2.0
Check if a function exists (native or custom)
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). It is useful if a script needs to determine if it is being run on an older version of the firmware that might not have some of the newer functions. It can also be used for controlling flow in scripts that define custom functions depending on certain conditions or included files.
$function_name: String containing the name of the function to check for existence
Integer: 1 (true) if the function exists, 0 (false) if the function does not exist
<? $f="array_key" if (function_exists("array_key")) { print("The function 'array_key' is available"); } else { print("The function 'array_key' is NOT available"); } ?>
<? include("/my_functions.inc"); $f="my_function_number_23"; if (function_exists($f)) { print(call_user_func($f,1,3)); } else { print("Error: '/my_functions.inc' does not include function '".$f."'"); die(); } ?>
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
function - Define a function