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.get-resource-type.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.var.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.get-resource-type.php',
   
1 => 'get_resource_type',
  ),
 
'up' =>
  array (
   
0 => 'ref.var.php',
   
1 => 'Variable handling Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.get-defined-vars.php',
   
1 => 'get_defined_vars',
  ),
 
'next' =>
  array (
   
0 => 'function.gettype.php',
   
1 => 'gettype',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.get-resource-type" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">get_resource_type</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.2, PHP 5)</p><p class="refpurpose"><span class="refname">get_resource_type</span> &mdash; <span class="dc-title">
   Returns the resource type
  </span></p>

 </div>

 <a name="function.get-resource-type.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><b>get_resource_type</b></span>
    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$handle</tt></span>
   )</div>

  <p class="para rdfs-comment">
   This function gets the type of the given resource.
  </p>
 </div>


 <a name="function.get-resource-type.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">handle</tt></i>
</span>

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

      <p class="para">
       The evaluated resource handle.
      </p>
     </dd>

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


 <a name="function.get-resource-type.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   If the given <i><tt class="parameter">handle</tt></i>
 is a resource, this function
   will return a string representing its type. If the type is not identified
   by this function, the return value will be the string
   <i>Unknown</i>.
  </p>
  <p class="para">
   This function will return <b><tt class="constant">FALSE</tt></b> and generate an error if
   <i><tt class="parameter">handle</tt></i>
 is not a <a href="language.types.resource.php" class="type resource">resource</a>.
  </p>
 </div>


 <a name="function.get-resource-type.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>get_resource_type()</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: #FF8000">//&nbsp;prints:&nbsp;mysql&nbsp;link<br /></span><span style="color: #0000BB">$c&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_connect</span><span style="color: #007700">();<br />echo&nbsp;</span><span style="color: #0000BB">get_resource_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;prints:&nbsp;file<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"w"</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">get_resource_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">//&nbsp;prints:&nbsp;domxml&nbsp;document<br /></span><span style="color: #0000BB">$doc&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">new_xmldoc</span><span style="color: #007700">(</span><span style="color: #DD0000">"1.0"</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">get_resource_type</span><span style="color: #007700">(</span><span style="color: #0000BB">$doc</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">doc</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

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

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