Dynamic loading of extension

Print
Here is a function used in SQLiteManager, to verify the presence of the SQLite extension and if any, attempts to dynamically load:
SQLiteLoaded function () (
$ SQL_SERVER_OS = strtoupper (substr (PHP_OS, 0, 3));
if ($ SQL_SERVER_OS == 'WIN') (
$ preffix = 'php_'; $ extname = 'sqlite', $ suffix = '. dll';
) Elseif ($ SQL_SERVER_OS == 'NET') (
$ preffix = 'php_'; $ extname = 'sqlite', $ suffix = '. nlm';
) Elseif (($ SQL_SERVER_OS == 'LIN') | | ($ SQL_SERVER_OS == 'RAF')) (
$ preffix =''; $ extname = 'sqlite', $ suffix = '. so';
)
if (substr (phpversion (), 0, 1) == '5 ') return true;
get_loaded_extensions $ extensions = ();
foreach ($ extensions as $ key => $ ext) $ extensions [$ key] = strtolower ($ ext);
if (! extension_loaded ($ extname) & &! in_array ( 'sqlite', get_loaded_extensions ())) (
if (@ dl ($ preffix. extname $. $ suffix)) (
return true;
Else ()
return false;
)
) Else return true;
)

This function works for Windows platforms, Linux, Mac and Netware. If you use other platforms, add comments in its specificity.