title: Converting php array with attributes to XML
body: <p>I'm working on an XML library, that can create / parse xml's from arrays/jsons.
  I managed to write the parser with xml_parser (and google help :p) cause SimpleXML wasn't good enough for what I'm doing.</p>
  
  <p>I've managed to create an array that looks something like that:</p>
  
  <pre><code>Array 
  (
  [flow] =&gt; Array
      (
          [math] =&gt; Array
              (
                  [apply] =&gt; Array
                      (
                          [lt] =&gt; Array
                              (
                              )
  
                          [apply] =&gt; Array
                              (
                                  [divide] =&gt; Array
                                      (
                                      )
  
                                  [apply] =&gt; Array
                                      (
                                          [minus] =&gt; Array
                                              (
                                              )
                                      )
                              )
  
                          [otherStuff] =&gt; 0
                      )
  
              )
  
          [true] =&gt; Array
              (
  
  
              )
  
          [true_attr] =&gt; Array
              (
                  [xsi:type] =&gt; SomeStuff
                  [id] =&gt; 2
              )
  
      )
  
  [flow_attr] =&gt; Array
      (
          [id] =&gt; 0
          [xmlns:xsi] =&gt; http://www.w3.org/2001/XMLSchema-instance
      )
  )
  </code></pre>
  
  <p>As you can see, it should look something like this ( not the best example :p ):</p>
  
  <pre><code>&lt;flow id="0"&gt;
   &lt;math&gt;
   &lt;lalaa/&gt;
    &lt;appyl&gt;
   &lt;/apply&gt;
    &lt;/math&gt;
  &lt;/flow&gt;
  </code></pre>
  
  <p>Note that empty arrays should end with /> for example  ,  and so on</p>
  
  <p>As you can see I separated the node it self to node_attr that contains the attrs of the nodes. Like flow_attr, true_attr.</p>
  
  <p>Anyone have an idea how to convert this array back to xml?
  I'm just lost and don't know what to do.</p>
  
  <p>Thanks for the help! </p>