1
0
mirror of https://github.com/php/doc-es.git synced 2026-03-26 00:12:06 +01:00
Files
archived-doc-es/reference/weakref/book.xml
Pedro Antonio Gil Rodríguez 36b5b9338f Updated to the most recent version
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@330479 c90b9560-bf6c-de11-be94-00142212c4b1
2013-06-12 09:31:11 +00:00

95 lines
2.1 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1634a886415d0ab4df195fe49d18a1c150b70758 Maintainer: seros Status: ready -->
<!-- Reviewed: no -->
<book xml:id="book.weakref" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Referencias débiles</title>
<titleabbrev>Weakref</titleabbrev>
<preface xml:id="intro.weakref">
&reftitle.intro;
<para>
Las referencias débiles proporcionan una vía no intrusiva para objetos efímeros. A diferencia de
las referencias normales (fuertes), las referencias débiles no evita que el recolector de
basura libere un objeto. Por esta razón, un objeto podría ser
destruido aunque aún exista una referencia débil a tal objeto. En tales
condiciones, la referencia débil sería perfectamente inválida.
</para>
<para>
<example>
<title>Ejemplo de uso de <classname>Weakref</classname></title>
<programlisting role="php">
<![CDATA[
<?php
class MiClase {
public function __destruct() {
echo "¡Destruyendo el objeto!\n";
}
}
$o1 = new MiClase;
$r1 = new Weakref($o1);
if ($r1->valid()) {
echo "¡El objeto aún existe!\n";
var_dump($r1->get());
} else {
echo "¡El objeto está muerto!\n";
}
unset($o1);
if ($r1->valid()) {
echo "¡El objeto aún existe!\n";
var_dump($r1->get());
} else {
echo "¡El objeto está muerto!\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
¡El objeto aún existe!
object(MiClase)#1 (0) {
}
¡Destruyendo el objeto!
¡El objeto está muerto!
]]>
</screen>
</example>
</para>
</preface>
&reference.weakref.setup;
&reference.weakref.weakref;
&reference.weakref.weakmap;
</book>
<!-- 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
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
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
-->