title: Foreach loop only runs once
body: <p>got a problem with a foreach loop. The problem is the following:</p>
  
  <pre><code>foreach($content as $c) {
      $root-&gt;appendChild($node = $dom-&gt;createElement($table));
      $node-&gt;setAttribute("id", $content['id']);
  
      foreach($c as $key =&gt; $value) {
          $node-&gt;appendChild($dom-&gt;createElement($key, $value));
      }
  }
  </code></pre>
  
  <p>$content contains all the data sets from a table. So $c should contain only one. And thats exactly what it does:</p>
  
  <pre><code>Array
  (
      [0] =&gt; 11
      [id] =&gt; 11
      [1] =&gt; admin
      [username] =&gt; admin
      [2] =&gt; $2a$08$tpTWqFtZq1KzyIfD/UYI2u5iyGQw.m0.TGJSWx5gwsb/RaJAmdULK
      [password] =&gt; $2a$08$tpTWqFtZq1KzyIfD/UYI2u5iyGQw.m0.TGJSWx5gwsb/RaJAmdULK
      [3] =&gt; 
      [group] =&gt; 
      [4] =&gt; 0
      [deleted] =&gt; 0
  )
  </code></pre>
  
  <p>So in the 2nd foreach loop, it should get every single element together with its key and attack it to the node, but its only running once. If i dump $key and $value inside the foreach loop, i only get 2 values, 0 and 11. Thats correct, but it should run 8 times, not only once. Can anybody tell me where my error is?</p>
  
  <p>Edit/ Content of $content:</p>
  
  <pre><code>array(2) {
    [0]=&gt;
    array(10) {
      [0]=&gt;
      string(2) "11"
      ["id"]=&gt;
      string(2) "11"
      [1]=&gt;
      string(5) "admin"
      ["username"]=&gt;
      string(5) "admin"
      [2]=&gt;
      string(60) "$2a$08$tpTWqFtZq1KzyIfD/UYI2u5iyGQw.m0.TGJSWx5gwsb/RaJAmdULK"
      ["password"]=&gt;
      string(60) "$2a$08$tpTWqFtZq1KzyIfD/UYI2u5iyGQw.m0.TGJSWx5gwsb/RaJAmdULK"
      [3]=&gt;
      string(0) ""
      ["group"]=&gt;
      string(0) ""
      [4]=&gt;
      string(1) "0"
      ["deleted"]=&gt;
      string(1) "0"
    }
    [1]=&gt;
    array(10) {
      [0]=&gt;
      string(2) "25"
      ["id"]=&gt;
      string(2) "25"
      [1]=&gt;
      string(6) "mlange"
      ["username"]=&gt;
      string(6) "mlange"
      [2]=&gt;
      string(60) "$2a$08$X/fDcVsbrIE3sAHjU44aNOxQPe2Gg2wRDdd/YeRFT54rmdNucbJ5e"
      ["password"]=&gt;
      string(60) "$2a$08$X/fDcVsbrIE3sAHjU44aNOxQPe2Gg2wRDdd/YeRFT54rmdNucbJ5e"
      [3]=&gt;
      string(0) ""
      ["group"]=&gt;
      string(0) ""
      [4]=&gt;
      string(1) "0"
      ["deleted"]=&gt;
      string(1) "0"
    }
  }
  </code></pre>