public static function loadExtension($ext)
    {
        /* If $ext is already loaded, our work is done. */
        if (self::extensionExists($ext)) {
            return true;
        }

        /* See if we can call dl() at all, by the current ini settings.
         * dl() has been removed in some PHP 5.3 SAPIs. */
        if ((ini_get('enable_dl') != 1) ||
            (ini_get('safe_mode') == 1) ||
            !function_exists('dl')) {
            return false;
        }

        if (!strncasecmp(PHP_OS, 'WIN', 3)) {
            $suffix = 'dll';
        } else {
            switch (PHP_OS) {
            case 'HP-UX':
                $suffix = 'sl';
                break;

            case 'AIX':
                $suffix = 'a';
                break;

            case 'OSX':
                $suffix = 'bundle';
                break;

            default:
                $suffix = 'so';
            }
        }

        return dl($ext . '.' . $suffix) || dl('php_' . $ext . '.' . $suffix);
    }
public static function loadExtension($ext)
    {
        /* If $ext is already loaded, our work is done. */
        if (self::extensionExists($ext)) {
            return true;
        }

        /* See if we can call dl() at all, by the current ini settings.
         * dl() has been removed in some PHP 5.3 SAPIs. */
        if ((ini_get('enable_dl') != 1) ||
            (ini_get('safe_mode') == 1) ||
            !function_exists('dl')) {
            return false;
        }

        if (!strncasecmp(PHP_OS, 'WIN', 3)) {
            $suffix = 'dll';
        } else {
            switch (PHP_OS) {
            case 'HP-UX':
                $suffix = 'sl';
                break;

            case 'AIX':
                $suffix = 'a';
                break;

            case 'OSX':
                $suffix = 'bundle';
                break;

            default:
                $suffix = 'so';
            }
        }

        return dl($ext . '.' . $suffix) || dl('php_' . $ext . '.' . $suffix);
    }
public static function loadExtension ( $ ext ) { /* If $ext is already loaded, our work is done. */ if ( self :: extensionExists ( $ ext ) ) { return true ; } /* See if we can call dl() at all, by the current ini settings.
         * dl() has been removed in some PHP 5.3 SAPIs. */ if ( ( ini_get ( 'enable_dl' ) != 1 ) || ( ini_get ( 'safe_mode' ) == 1 ) || ! function_exists ( 'dl' ) ) { return false ; } if ( ! strncasecmp ( PHP_OS , 'WIN' , 3 ) ) { $ suffix = 'dll' ; } else { switch ( PHP_OS ) { case 'HP-UX' : $ suffix = 'sl' ; break ; case 'AIX' : $ suffix = 'a' ; break ; case 'OSX' : $ suffix = 'bundle' ; break ; default : $ suffix = 'so' ; } } return dl ( $ ext . '.' . $ suffix ) || dl ( 'php_' . $ ext . '.' . $ suffix ) ; }
Tries to load a PHP extension, behaving correctly for all operating
systems.

@param string $ext  The extension to load.

@return boolean  True if the extension is now loaded, false if not.
True can mean that the extension was already loaded,
OR was loaded dynamically.
Tries to load a PHP extension behaving correctly for all operating systems .