2008-02-14 19:57:17 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:17:58 +00:00
|
|
|
<!-- $Revision$ -->
|
2008-02-14 20:50:33 +00:00
|
|
|
<sect1 xml:id="language.types.resource">
|
2008-02-21 18:43:17 +00:00
|
|
|
<title>Resources</title>
|
2008-02-14 20:50:33 +00:00
|
|
|
|
|
|
|
<para>
|
2008-02-21 18:43:17 +00:00
|
|
|
A <type>resource</type> is a special variable, holding a reference to an
|
|
|
|
external resource. Resources are created and used by special functions. See
|
|
|
|
the <link linkend="resource">appendix</link> for a listing of all these
|
|
|
|
functions and the corresponding <type>resource</type> types.
|
2008-02-14 20:50:33 +00:00
|
|
|
</para>
|
2008-02-14 19:57:17 +00:00
|
|
|
|
2008-02-14 20:50:33 +00:00
|
|
|
<para>
|
2008-02-21 18:43:17 +00:00
|
|
|
See also the <function>get_resource_type</function> function.
|
2008-02-14 20:50:33 +00:00
|
|
|
</para>
|
2008-02-14 19:57:17 +00:00
|
|
|
|
2008-02-14 20:50:33 +00:00
|
|
|
<sect2 xml:id="language.types.resource.casting">
|
|
|
|
<title>Converting to resource</title>
|
|
|
|
|
|
|
|
<para>
|
2008-02-21 18:43:17 +00:00
|
|
|
As <type>resource</type> variables hold special handlers to opened files,
|
|
|
|
database connections, image canvas areas and the like, converting to a
|
|
|
|
<type>resource</type> makes no sense.
|
2008-02-14 20:50:33 +00:00
|
|
|
</para>
|
|
|
|
</sect2>
|
2008-02-14 19:57:17 +00:00
|
|
|
|
2008-02-14 20:50:33 +00:00
|
|
|
<sect2 xml:id="language.types.resource.self-destruct">
|
|
|
|
<title>Freeing resources</title>
|
|
|
|
|
|
|
|
<para>
|
2008-02-21 18:43:17 +00:00
|
|
|
Thanks to the reference-counting system introduced with PHP 4's Zend Engine,
|
|
|
|
a <type>resource</type> 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.
|
2008-02-14 20:50:33 +00:00
|
|
|
</para>
|
2008-02-18 22:32:54 +00:00
|
|
|
|
|
|
|
<note>
|
|
|
|
<simpara>
|
2008-02-21 18:43:17 +00:00
|
|
|
Persistent database links are an exception to this rule. They are
|
|
|
|
<emphasis>not</emphasis> destroyed by the garbage collector. See the
|
2008-02-18 22:32:54 +00:00
|
|
|
<link linkend="features.persistent-connections">persistent
|
2008-02-21 18:43:17 +00:00
|
|
|
connections</link> section for more information.
|
2008-02-18 22:32:54 +00:00
|
|
|
</simpara>
|
|
|
|
</note>
|
2008-02-14 20:50:33 +00:00
|
|
|
|
|
|
|
</sect2>
|
|
|
|
</sect1>
|
2008-02-14 19:57:17 +00:00
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2008-02-14 19:57:17 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|