title: create Dynamic XML elements php
body: <p>I need to create the Dynamic XML Elements and i have almost done it for the Value tag but I am still having some issue with Name Tag in XML.</p>
  
  <pre><code>&lt;?php    
      foreach ($shot as $shotx){
          $metadata=$xml-&gt;createElement("metadata");
          $clip-&gt;appendChild($metadata);
          $name=$xml-&gt;createElement("name","shotL");
          $metadata-&gt;appendChild($name);
          $value=$xml-&gt;createElement("value",$shotx);
          $metadata-&gt;appendChild($value); 
      ?&gt;
  </code></pre>
  
  <p>The output of the Above code is almost as i have expected instead of Name Tag. so the current output is written below:</p>
  
  <pre><code>&lt;metadata&gt; &lt;name&gt;shotL&lt;/name&gt; &lt;value&gt;value1&lt;/value&gt;&lt;/metadata&gt; 
  
  &lt;metadata&gt; &lt;name&gt;shotL&lt;/name&gt; &lt;value&gt;value2&lt;/value&gt; &lt;/metadata&gt;
  
  &lt;metadata&gt; &lt;name&gt;shotL&lt;/name&gt; &lt;value&gt;value3&lt;/value&gt; &lt;/metadata&gt; 
  
  &lt;metadata&gt; &lt;name&gt;shotL&lt;/name&gt; &lt;value&gt;value4&lt;/value&gt; &lt;/metadata&gt;
  
  &lt;metadata&gt; &lt;name&gt;shotL&lt;/name&gt; &lt;value&gt;value5&lt;/value&gt; &lt;/metadata&gt;
  </code></pre>
  
  <p>I would also need to have the dynamic value in the name tag like Below:</p>
  
  <pre><code>&lt;metadata&gt; &lt;name&gt;**shotL**&lt;/name&gt; &lt;value&gt;value1&lt;/value&gt;&lt;/metadata&gt; 
  
  &lt;metadata&gt; &lt;name&gt;**shotL.1**&lt;/name&gt; &lt;value&gt;value2&lt;/value&gt; &lt;/metadata&gt;
  
  &lt;metadata&gt; &lt;name&gt;**shotL.2**&lt;/name&gt; &lt;value&gt;value3&lt;/value&gt; &lt;/metadata&gt; 
  
  &lt;metadata&gt; &lt;name&gt;**shotL.3&lt;**/name&gt; &lt;value&gt;value4&lt;/value&gt; &lt;/metadata&gt;
  
  &lt;metadata&gt; &lt;name&gt;**shotL.4**&lt;/name&gt; &lt;value&gt;value5&lt;/value&gt; &lt;/metadata&gt;
  </code></pre>
  
  <p>Basically the name Tag must also contain incremental Value like:</p>
  
  <pre><code>shotL
  shotL.1
  shotL.2
  shotL.3
  shotL.4
  </code></pre>
  
  <p>Please help me , Thanking you in advance.</p>