PHP - function_exists()
The function_exists() function can return true if a given function has been defined.
Syntax
bool function_exists( string $function_name )
The function_exists() function can check a list of defined functions, both built-in (internal) and user-defined for function_name. This function can return true, if function_name exist, or false otherwise.
Example
<?php
$function_name = "fopen";
if (function_exists($function_name) ) {
echo "$function_name is enabled";
} else {
echo "$function_name is not enabled";
}
?>
Output
fopen is enabled
php_function_reference.htm
Advertisements