downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.extension-loaded.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.info.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.extension-loaded.php',
   
1 => 'extension_loaded',
  ),
 
'up' =>
  array (
   
0 => 'ref.info.php',
   
1 => 'PHP Options/Info Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.dl.php',
   
1 => 'dl',
  ),
 
'next' =>
  array (
   
0 => 'function.gc-collect-cycles.php',
   
1 => 'gc_collect_cycles',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.extension-loaded" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">extension_loaded</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">extension_loaded</span> &mdash; <span class="dc-title">Find out whether an extension is loaded</span></p>

 </div>
 
 <a name="function.extension-loaded.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>extension_loaded</b></span>
    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$name</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Finds out whether the extension is loaded.
  </p>
 </div>


 <a name="function.extension-loaded.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">name</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The extension name.
      </p>
      <p class="para">
       You can see the names of various extensions by using
       <a href="function.phpinfo.php" class="function">phpinfo()</a> or if you&#039;re using the
       <i>CGI</i> or <i>CLI</i> version of
       PHP you can use the <span class="option">-m</span> switch to
       list all available extensions:
       <div class="example-contents screen">
<div class="cdata"><pre>
$ php -m
[PHP Modules]
xml
tokenizer
standard
sockets
session
posix
pcre
overload
mysql
mbstring
ctype

[Zend Modules]
</pre></div>
       </div>
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.extension-loaded.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> if the extension identified by <i><tt class="parameter">name</tt></i>

   is loaded, <b><tt class="constant">FALSE</tt></b> otherwise.
  </p>
 </div>


 <a name="function.extension-loaded.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
   <p><b>Example #1 <b>extension_loaded()</b> example</b></p>
   <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">extension_loaded</span><span style="color: #007700">(</span><span style="color: #DD0000">'gd'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">dl</span><span style="color: #007700">(</span><span style="color: #DD0000">'gd.so'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div><p>
  </p>
 </div>


 <a name="function.extension-loaded.changelog"></a><div class="refsect1 changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   </p><table class="doctable informaltable">
   
     <thead valign="middle">
      <tr valign="middle">
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody valign="middle" class="tbody">
      <tr valign="middle">
       <td align="left">5.0.0</td>
       <td align="left">
        <b>extension_loaded()</b> uses the internal extension name
        to test whether a certain extension is available or not. Most internal
        extension names are written in lower case but there may be extensions
        available which also use uppercase letters. Prior to PHP 5, this function
        compared the names case sensitively.
       </td>
      </tr>

     </tbody>
   
   </table>
<p>
  </p>
 </div>


 <a name="function.extension-loaded.seealso"></a><div class="refsect1 seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   </p><ul class="simplelist">
    <li class="member"><a href="function.get-loaded-extensions.php" class="function" rel="rdfs-seeAlso">get_loaded_extensions()</a> - Returns an array with the names of all modules compiled and loaded</li>
    <li class="member"><a href="function.get-extension-funcs.php" class="function" rel="rdfs-seeAlso">get_extension_funcs()</a> - Returns an array with the names of the functions of a module</li>
    <li class="member"><a href="function.phpinfo.php" class="function" rel="rdfs-seeAlso">phpinfo()</a> - Outputs lots of PHP information</li>
    <li class="member"><a href="function.dl.php" class="function" rel="rdfs-seeAlso">dl()</a> - Loads a PHP extension at runtime</li>
   </ul><p>
  </p>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites