vrana Fri Aug 17 22:03:55 2007 UTC
Modified files:
/phpdoc/en/language control-structures.xml
Log:
Unset foreach references manually (bug #37410)
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/control-structures.xml?r1=1.147&r2=1.148&diff_format=u
Index: phpdoc/en/language/control-structures.xml
diff -u phpdoc/en/language/control-structures.xml:1.147
phpdoc/en/language/control-structures.xml:1.148
--- phpdoc/en/language/control-structures.xml:1.147 Fri Aug 17 21:58:32 2007
+++ phpdoc/en/language/control-structures.xml Fri Aug 17 22:03:53 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.147 $ -->
+<!-- $Revision: 1.148 $ -->
<chapter xml:id="language.control-structures"
xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Control Structures</title>
@@ -565,6 +565,7 @@
$value = $value * 2;
}
// $arr is now array(2, 4, 6, 8)
+unset($value); // break the reference with the last element
?>
]]>
</programlisting>
@@ -572,6 +573,13 @@
This is possible only if iterated array can be referenced (i.e. is
variable).
</para>
+ <warning>
+ <para>
+ Reference of a <literal>$value</literal> and the last array element
+ remain even after the <literal>foreach</literal> loop. It is recommended
+ to destroy it by <function>unset</function>.
+ </para>
+ </warning>
<para>
<note>
<para>