PHP detects if a function has a function function_exists syntax bool Function_exists (string $function _name) checks the list of defined functions, both built-in (internal) and user-defined, for Function_ Name return value
PHP Tutorial detects if a function has a function function_exists
Grammar
BOOL Function_exists (string $function _name)
Check the list of defined functions, both built-in (internal) and user-defined, for function_name.
return value
Returns true if Function_name exists, is a function, otherwise returns FALSE.
*/
if (function_exists (' Imap_open ')) {
echo "IMAP functions is available.www.bkjia.com
n ";
} else {
echo "IMAP functions is not available.
n ";
}
Function_exists returns false on null and empty string:
if (Function_exists (")) {
echo "Empty string function EXISTSN";
}
if (function_exists (null)) {
echo "null function EXISTSN";
}
If you use Suhosin.executor.func.blacklist instead of your php.ini disabled_functions,function_exists will return true for functionality. I use this to have the same beahviour as Suhosin.executor.func.blacklist and disabled_functions:
function Suhosin_function_exists ($func) {
if (extension_loaded (' Suhosin ')) {
$suhosin = @ini_get ("Suhosin.executor.func.blacklist");
if (empty ($suhosin) = = False) {
$suhosin = Explode (', ', $suhosin);
$suhosin = Array_map (' Trim ', $suhosin);
$suhosin = Array_map (' Strtolower ', $suhosin);
Return (function_exists ($func) = = True && array_search ($func, $suhosin) = = = = False);
}
}
Return function_exists ($func);
}
http://www.bkjia.com/PHPjc/445447.html www.bkjia.com true http://www.bkjia.com/PHPjc/445447.html techarticle PHP detects if a function has a function function_exists syntax bool Function_exists (string $function _name) checks the list of defined functions, both built-in (internal) and user-defined, for ...