Simplexml only shows first array elements even with children() method <p>I'm using PHP 5.6.</p> <p>I'm consuming an amazon API and getting back some products form a product search. </p> <p>I have got the raw xml string back and loaded it in to simplexml with </p> <pre><code>$xml = simplexml_load_string($result); </code></pre> <p>Now if I do </p> <pre><code>print_r($xml-&gt;response-&gt;Items); </code></pre> <p>I get (condensed):</p> <pre><code>SimpleXMLElement Object ( [Request] =&gt; SimpleXMLElement Object ( [IsValid] =&gt; True ) [TotalResults] =&gt; 8914365 [TotalPages] =&gt; 891437 [Item] =&gt; Array ( [0] =&gt; SimpleXMLElement Object ( [ASIN] =&gt; B00QJDO0QC [ParentASIN] =&gt; B00U879AII ) [1] =&gt; SimpleXMLElement Object ( [ASIN] =&gt; B01HDUE8HE [ParentASIN] =&gt; 000000000 ) [2] =&gt; SimpleXMLElement Object ( [ASIN] =&gt; B72HEUD9HE [ParentASIN] =&gt; 000000000 ) ) ) </code></pre> <p>So I want to isolate the 'Items' array so I can process the returned items. So I obviously do:</p> <pre><code>$items = $xml-&gt;response-&gt;Items-&gt;Item; </code></pre> <p>But now if I do </p> <pre><code>print_r($items); </code></pre> <p>I don't get the three elements, I just get a print out of the FIRST $items element like so:</p> <pre><code>SimpleXMLElement Object ( [ASIN] =&gt; B00QJDO0QC [ParentASIN] =&gt; B00U879AII ) </code></pre> <p>I read here: <a href="http://stackoverflow.com/questions/6796797/why-does-simplexml-change-my-array-to-the-arrays-first-element-when-i-use-it">Why does SimpleXML change my array to the array&#39;s first element when I use it?</a> that you need to use the ->children() method. So I tried:</p> <pre><code>print_r($items-&gt;children()); </code></pre> <p>With still the same output. </p> <p>Can anyone help me out?</p>