How To Check if the cURL PHP extension is loaded

There is not a lot of information about checking if a particular extension is loaded and the few tidbits there are on the internet, are very impractical, so I decided to dig a bit deeper and I came up with my own solution.

The following function returns TRUE if it can find the cURL extension installed, and FALSE if it fails to find it.

[php]
// ### Checks for presence of the cURL extension.
function _iscurlinstalled() {
if (in_array (‘curl’, get_loaded_extensions())) {
return true;
}
else{
return false;
}
}
[/php]

Sample usage:

[php]
if (_iscurlinstalled()) echo "cURL is installed"; else echo "cURL is NOT installed";
[/php]