extension_loaded()
extension_loaded() — Find out whether an extension is loaded.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
Signature
extension_loaded(string $extension): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $extension | string | The extension name. This parameter is case-insensitive. |
Return value
Returns true if the extension identified by extension is loaded, false otherwise.
Example
A runnable snippet:
if (!extension_loaded('gd')) { if (!dl('gd.so')) { exit; } }
See also
get_loaded_extensions(), get_extension_funcs(), phpinfo(), dl(), function_exists()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page extension_loaded() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.