title: Parse the nested variables in XML using PHP
body: <p>I have been playing with XML and PHP, I have googled to get the requirement which I am working on but still Im not getting the things the way I wanted. </p>
  
  <p>I have got a XML file with nested variables, I need to parse the variables such as user_id, name and store it in an array, so that I need to use them to change the details in another config file.</p>
  
  <p>For ex: if the user is logged in, using the user_id, i need to parse the all the data of the particular user from the XML file (where the details of the various users are stored).</p>
  
  <p>Until now I could only parse the data and echo all of it but could not find a way to store this parsed information.</p>
  
  <p>This is my test.xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;document&gt;
      &lt;user&gt;
          &lt;user_id&gt;0121&lt;/user_id&gt;
          &lt;name&gt;Tim&lt;/name&gt;
          &lt;file&gt;0121.file&lt;/file&gt;
      &lt;/user&gt;
  
      &lt;user&gt;
          &lt;user_id&gt;0178&lt;/user_id&gt;
          &lt;name&gt;Henry&lt;/name&gt;
          &lt;file&gt;0178.file&lt;/file&gt;
      &lt;/user&gt;
  
      &lt;user&gt;
          &lt;user_id&gt;0786&lt;/user_id&gt;
          &lt;name&gt;Martin&lt;/name&gt;
          &lt;file&gt;0786.file&lt;/file&gt;
      &lt;/user&gt;
  
      &lt;user&gt;
          &lt;user_id&gt;1239&lt;/user_id&gt;
          &lt;name&gt;Jan&lt;/name&gt;
          &lt;file&gt;1239.file&lt;/file&gt;
      &lt;/user&gt;
  &lt;/document&gt;
  </code></pre>
  
  <p>Any valuable information would be greatly helpful</p>
  
  <p>Thanks
  Raaks</p>