title: Looping xml files using glob function only loops the last file in the folder
body: <p>I've tried searching but couldn't really find an answer so I figured that I'd post a new question instead.</p>
  <p>I have a folder with several xml files. I want to loop though all of these files.</p>
  <p>This is my current code:</p>
  <pre><code>&lt;?php
    $files = glob(&quot;visitkort/*xml&quot;);
      if (is_array($files)) {
  
       foreach($files as $filename) {
          $xmlstr = file_get_contents($filename, FILE_TEXT);
       }
  
  
  
      }
      $visitkort = new SimpleXMLElement($xmlstr);
  
      foreach ($visitkort-&gt;person as $person) {
             echo '&lt;article class=&quot;productInfo&quot;&gt;&lt;a href=&quot;redigera.php?id=&quot;&gt;&lt;div&gt; &lt;p class=&quot;price&quot;&gt;', $person-&gt;namn, '&lt;/p&gt;&lt;p class=&quot;productContent&quot;&gt;', $person-&gt;titel,  '&lt;/p&gt;&lt;/div&gt;&lt;/a&gt; &lt;/article&gt;', PHP_EOL;
          }
  
  ?&gt;
  </code></pre>
  <p>Which works fine, except that it will only list the last file in the folder (e.g. I have three files named &quot;1.xml&quot;, &quot;2.xml&quot; and &quot;3.xml&quot;, only the info in the file &quot;3.xml&quot; will be listed) instead of all files.
  What did I do wrong and how do I fix it?</p>
  <p>Best regards,
  Camilla</p>