<?xml version="1.0" encoding="windows-1252"?>
<node id="72637" title="Re: Re: NEWBIE Brain Teaser" created="2001-04-15 04:04:14" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="44293">
Ri-Del</author>
<data>
<field name="doctext">
&lt;P&gt;Alright, I also expected a return of 1,2,3,4, and 5 as the values printed out.  However, I think I have learned where I went wrong.  I just wanted to make sure I understood the last paragraph of HOW THE CODE WORKS.&lt;/P&gt;

&lt;P&gt;If I understand this correctly, the &lt;CODE&gt;$each&lt;/CODE&gt; variable actually acts as a reference to the current place in the array that the &lt;CODE&gt;foreach&lt;/CODE&gt; loop is currently at.  So in effect we are actually altering the first array with the &lt;CODE&gt;$each *= 2;&lt;/CODE&gt; and then simply setting the &lt;CODE&gt;$i&lt;/CODE&gt; place in the &lt;CODE&gt;@newlist&lt;/CODE&gt; to be the same value.  This is the reason why we are subtracting, in the last loop, the exact same values from each other.&lt;/P&gt;</field>
<field name="root_node">
72605</field>
<field name="parent_node">
72634</field>
</data>
</node>
