extension_loaded

bool extension_loaded(string name) 

Checks for an extension.

Returns:

TRUE if extension is loaded; FALSE on error

Description:

Checks whether an extension is loaded into PHP. This can be useful in more complex scripts in which functionality depends on an extension being present. For example, a graphing class can check for the existence of the GD library before any other action is taken and produce a friendly error if no GD support is available, or try to load the extension itself.

Version:

Existing since version 3.0.10

Example:

Check for GD support
if (extension_loaded("gd")) {
   echo "Extension found"; 
} else {
   echo "Extension not found. Attempting load"; 
   dl("php_gd.dll"); 
} 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.