Use extension_loaded instead of function_exists().