extension_loaded() in PHP

extension_loaded() in PHP

PHP 3 and above supports function extension_loaded() which findx out whether a extension is loaded or not.
syntax : bool extension_loaded ( string name )

This function returns TRUE if the extension identified by name is loaded, FALSE otherwise.

This function is not much used in the simple coding of small websites, but when applications are created then for finding out the different extensions loaded with PHP on individual systems this function is used.

For example, if one want to find out whether ‘gd’ has been installed then use this function as follows :
if (extension_loaded(‘gd’))
echo “GD installed”;
echo “GD not installed”;

We can use this code on any web page if want to find out if GD support is enabled on our server or not. Nowadays, many servers require GD support for using different image functions of PHP.

There are a number of extensions used in PHP; all the extensions can be found using phpinfo().


Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.