Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 8967

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Resources</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.types.object.html">Objects</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.types.null.html">NULL</a></div>
 <div class="up"><a href="language.types.html">Types</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="language.types.resource" class="sect1">
 <h2 class="title">Resources</h2>
  
 <p class="para">
  A <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> is a special variable, holding a reference to an
  external resource. Resources are created and used by special functions. See
  the <a href="resource.html" class="link">appendix</a> for a listing of all these
  functions and the corresponding <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> types.
 </p>

 <p class="para">
  See also the  <span class="function"><a href="function.get-resource-type.html" class="function">get_resource_type()</a></span> function.
 </p>

 <div class="sect2" id="language.types.resource.casting">
  <h3 class="title">Converting to resource</h3>
  
  <p class="para">
   As <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> variables hold special handlers to opened files,
   database connections, image canvas areas and the like, converting to a
   <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> makes no sense.
  </p>
 </div>

 <div class="sect2" id="language.types.resource.self-destruct">
  <h3 class="title">Freeing resources</h3>
  
  <p class="para">
   Thanks to the reference-counting system introduced with PHP 4&#039;s Zend Engine,
   a <span class="type"><a href="language.types.resource.html" class="type resource">resource</a></span> with no more references to it is detected
   automatically, and it is freed by the garbage collector. For this reason, it
   is rarely necessary to free the memory manually.
  </p>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    Persistent database links are an exception to this rule. They are
    <em class="emphasis">not</em> destroyed by the garbage collector. See the
    <a href="features.persistent-connections.html" class="link">persistent
    connections</a> section for more information.
   </span>
  </p></blockquote>
  
 </div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="language.types.object.html">Objects</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="language.types.null.html">NULL</a></div>
 <div class="up"><a href="language.types.html">Types</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>