cvs: phpdoc /en/reference/info/functions dl.xml

From: Date: Mon, 23 Jun 2003 03:11:20 +0000
Subject: cvs: phpdoc /en/reference/info/functions dl.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969354797@lists.php.net to get a copy of this message
philip Sun Jun 22 23:11:20 2003 EDT Modified files: /phpdoc/en/reference/info/functions dl.xml Log: Added examples to take into account OS, including use of PHP_SHLIB_SUFFIX. Also, windows -> Windows. Index: phpdoc/en/reference/info/functions/dl.xml diff -u phpdoc/en/reference/info/functions/dl.xml:1.12 phpdoc/en/reference/info/functions/dl.xml:1.13 --- phpdoc/en/reference/info/functions/dl.xml:1.12 Mon Jun 16 15:33:51 2003 +++ phpdoc/en/reference/info/functions/dl.xml Sun Jun 22 23:11:20 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/info.xml, last change in rev 1.29 --> <refentry id="function.dl"> <refnamediv> @@ -20,7 +20,7 @@ linkend="ref.sockets">sockets</link> extension (if compiled as a shared module, not the default!) would be called <filename>sockets.so</filename> on unix platforms whereas it is called - <filename>php_sockets.dll</filename> on the windows platform. + <filename>php_sockets.dll</filename> on the Windows platform. </para> <para> &return.success; If the functionality of loading modules is not available @@ -38,14 +38,25 @@ or <function>dl</function>). </para> <example> - <title><function>dl</function> example</title> + <title><function>dl</function> examples</title> <programlisting role="php"> <![CDATA[ -if (!extension_loaded('gd')) { - if (!dl('gd.so')) { - exit; +<?php +// Example loading an extension based on OS +if (!extension_loaded('sqlite')) { + if (strtoupper(substr(PHP_OS, 0,3) == 'WIN')) { + dl('php_sqlite.dll'); + } else { + dl('sqlite.so'); } } + +// Or, the PHP_SHLIB_SUFFIX constant is available as of PHP 4.3.0 +if (!extension_loaded('sqlite')) { + $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : ''; + dl($prefix . 'sqlite.' . PHP_SHLIB_SUFFIX); +} +?> ]]> </programlisting> </example>

« previous php.doc (#969354797) next »