We are using
PHP check function availability 1. Get all available modules-get_loaded_extensions
This function returns all loaded (available) modules.
Usage:
Print_r (get_loaded_extensions ());
PHP check function available 2. Get the available function of the specified module-get_extension_funcs
This function returns all available functions of the specified module. The input parameter (Module name) must be in lowercase.
Usage:
Print_r (get_extension_funcs ("gd "));
PHP check function available 3. Get all defined functions-get_defined_functions
This function returns all defined functions, including built-in functions and user-defined functions.
Usage:
- function myrow($id, $data){
- return "<tr><th>$id</th><td>$data</td></tr>n";
- }
- $arr = get_defined_functions();
- print_r($arr);
Output:
- Array
- (
- [internal] => Array
- (
- [0] => zend_version
- [1] => func_num_args
- [2] => func_get_arg
- [3] => func_get_args
- [4] => strlen
- [5] => strcmp
- [6] => strncmp
- ...
- [750] => bcscale
- [751] => bccomp
- )
- [user] => Array
- (
- [0] => myrow
- )
- )
$ Arr ["internal"] is a built-in function, and $ arr ["user"] is a user-defined function.
PHP check function availability 4. Check whether the specified function exists-function_exists
This function returns whether the specified function has been defined.
Usage:
- if (function_exists('imap_open')) {
- echo "IMAP functions are available.<br />n";
- } else {
- echo "IMAP functions are not available.<br />n";