Jack Ben Jack Ben - 5 months ago 18
PHP Question

how to check if curl is enabled or disabled


Possible Duplicate:

Writing a function in php




I'm using the following code

echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled';


this can get it enabled or disabled

but i would like to make as function say function name is
_iscurl


then i can call it as following any where in my website code

if (_iscurl()){
echo "this is enabled"; // will do an action
}else{
echo "this is disabled"; // will do another action
}


~ thanks

almost same as my previous question check if allow_url_fopen is enabled or not

Answer

Just return your existing check from a function.

function _isCurl(){
    return function_exists('curl_version');
}
Comments