title: Inserting a foreach output in a horizontal HTML table
body: <p>I'm a newbie who's been looking for a solution regarding inserting a PHP <code>foreach</code> output in a horizontal <strong>HTML</strong> table. In the <strong>Dataset</strong> <code>.xml</code> file, there are multiple Series and each has 24 x <code>TIME_PERIOD</code>'s and 24 x <code>OBS_VALUE</code>'s as attributes. </p>
  
  <p>My problem is that all of them are being listed vertically (naturally) by the code I wrote below and I do not know how to divide them horizontally. I'd be glad if you could help me create a horizontal table for each Series. </p>
  
  <p>Consider this screenshot of the current output: </p>
  
  <p><a href="https://i.stack.imgur.com/3zpu6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3zpu6.png" alt="enter image description here"></a></p>
  
  <p><strong>Code snippet:</strong></p>
  
  <pre><code>$xml=simplexml_load_file("00750006.xml") or die("Error: Cannot create object");                                                           
  
  foreach($xml-&gt;DataSet-&gt;Series as $series) {
  
     foreach($series-&gt;Obs as $obs) {
  
             $tp = (string)$obs["TIME_PERIOD"];
             $val = (string)$obs["OBS_VALUE"];
  
             echo "&lt;table&gt;&lt;tr&gt;
  
             &lt;td class='dataC'&gt;$tp&lt;/td&gt;
             &lt;td class='dataC'&gt;$val&lt;/td&gt;
  
                  &lt;/tr&gt;&lt;/table&gt;";
     } 
  }
  </code></pre>