Name

get_loaded_extensions()

Synopsis

    array get_loaded_extensions ( void )

The get_loaded_extensions() function takes no parameters and returns an array of the names of all extensions you have loaded.

    $extensions = get_loaded_extensions();
    echo "Extensions loaded:\n";
    foreach($extensions as $extension) {
            echo " $extension\n";
    }

If you just want to check whether a specific extension is loaded or not, without having to go through the fuss of sifting through the return value of get_loaded_extensions(), you can use the simple shortcut function extension_loaded(), which takes an extension name as its only parameter and returns true if it has loaded or false if not.

Get PHP in a Nutshell 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.