title: PHP for loop just displays 1 element
body: <p>I try to use <code>PHP for</code> and I'm pretty new to it. I have an <code>xml</code> file stored in a variable called <code>$xmlroot</code>. Here you can see my code:</p>
  
  <pre><code>&lt;?php
      $xmlroot = $_POST['xmldata'];
      //echo "Your data is: " . $xmlroot;
  
      $doc = new DOMDocument;
      $doc-&gt;loadXML($xmlroot);
  
      for($i = 0; $i &lt; count($xmlroot); $i++){
          echo $doc-&gt;getElementsByTagName('postalcode')-&gt;item($i)-&gt;nodeValue;
      }
  ?&gt;
  </code></pre>
  
  <p>But it just displays me the first <code>XML tag</code>. It should display all tags called "postalcode". My <code>XML</code> file looks like this:</p>
  
  <pre><code>&lt;root&gt;
      &lt;code&gt;
          &lt;postalcode&gt;12345&lt;/postalcode&gt;
          &lt;name&gt;Test1&lt;/name&gt;
      &lt;/code&gt;
      &lt;code&gt;
          &lt;postalcode&gt;67890&lt;/postalcode&gt;
          &lt;name&gt;Test2&lt;/name&gt;
      &lt;/code&gt;
      &lt;code&gt;
          &lt;postalcode&gt;13579&lt;/postalcode&gt;
          &lt;name&gt;Test3&lt;/name&gt;
      &lt;/code&gt;
      &lt;code&gt;
          &lt;postalcode&gt;02468&lt;/postalcode&gt;
          &lt;name&gt;Test1&lt;/name&gt;
      &lt;/code&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>It should display 4 elements but it displays just 1. Any suggestions?</p>
  
  <p>Thanks!</p>