title: Convert associative array to XML in PHP
body: <p>I was wondering if a function capable of converting an associative array to an XML document exists in PHP (or some widely available PHP library). </p>
  
  <p>I've searched quite a lot and could only find functions that do not output valid XML. I believe that the array I'm testing them on is correctly constructed, since it can be correctly used to generate a JSON document using json_encode. However, it is rather large and it is nested on four levels, which might explain why the functions I've tried so far fail.</p>
  
  <p>Ultimately, I will write the code to generate the XML myself but surely there must be a faster way of doing this.</p>