add to associative array
<p>I have some xml that looks like this:</p>

<pre><code>&lt;?xml version="1.0"?&gt;
    &lt;data&gt;
&lt;items&gt;
    &lt;item&gt;&lt;timestamp&gt;2011-07-11T09:01:42Z&lt;/timestamp&gt;&lt;title&gt;&lt;![CDATA[ some data here ]]&gt;&lt;/title&gt;&lt;link&gt;http://twitter.com/aurl&lt;/link&gt;&lt;/item&gt;
    &lt;item&gt;&lt;timestamp&gt;2011-05-11T09:01:42Z&lt;/timestamp&gt;&lt;title&gt;&lt;![CDATA[ some data here ]]&gt;&lt;/title&gt;&lt;link&gt;http://twitter.com/aurlhere&lt;/link&gt;&lt;/item&gt;
&lt;/items&gt;
</code></pre>

<p></p>

<p>and I'm trying to loop over it and add it to an array:</p>

<pre><code> foreach($xml-&gt;items-&gt;item as $e) {
              $feedData['timestamp'] = $e-&gt;timestamp;
            $feedData['title'] = $e-&gt;title;
            $feedData['link'] = $e-&gt;link;
            $feedData['type'] = $e-&gt;type;
        }

    print_r($feedData);
</code></pre>

<p>The xml is there and if I put an echo in the foreach I get back 10 responses (whcih are how many items I have) but when I print the array out all I get is one line (which is the last entry in the xml doc).</p>

<pre><code>Array ( [timestamp] =&gt; SimpleXMLElement Object ( [0] =&gt; 2011-07-08T08:05:19Z ) [title] =&gt; SimpleXMLElement Object ( ) [link] =&gt; SimpleXMLElement Object ( [0] =&gt; http://twitter.com.aurl ) [type] =&gt; SimpleXMLElement Object ( ) ) 
</code></pre>

<p>I suspoect I'm overwriting the array on each loop. But why ? It should be adding to the array. Sorry my php isn't great...hence what Is suspect is a bit of a stupid question. </p>
