The following function is more robust. It deals with the disabled_functions value having 0 or more spaces between function names, checks the suhosin patch's blacklist setting, covers safe_mode, and stores the answer for future reference.
function is_exec_available() {
static $available;
if (!isset($available)) {
$available = true;
if (ini_get('safe_mode')) {
$available = false;
} else {
$d = ini_get('disable_functions');
$s = ini_get('suhosin.executor.func.blacklist');
if ("$d$s") {
$array = preg_split('/,\s*/', "$d,$s");
if (in_array('exec', $array)) {
$available = false;
}
}
}
}
return $available;
}