function function_enabled($func) {
        // cache the list of disabled functions
        static $disabled = null;
        if ($disabled === null) $disabled = array_map('trim', array_map('strtolower', explode(',', ini_get('disable_functions'))));
        // cache the list of functions blacklisted by suhosin
        static $blacklist = null;
        if ($blacklist === null) $blacklist = extension_loaded('suhosin') ? array_map('trim', array_map('strtolower', explode(',', ini_get('  suhosin.executor.func.blacklist')))) : array();
        // checks if the function is really enabled
        return (function_exists($func) && !in_array($func, $disabled) && !in_array($func, $blacklist));
    }