title: Load PHP variables into XML file
body: <p>So, what i am trying to achieve is to load variables from PHP into an XML file.</p>
  
  <p>this is how my XML looks at the moment:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;firstname&gt;&lt;/firstname&gt;
  &lt;lastname&gt;&lt;/lastname&gt;
  </code></pre>
  
  <p>And this is my PHP where i try to save the variables into the XML</p>
  
  <pre><code>        $file = simplexml_load_file("filename.xml");
  
          $xml-&gt;firstname = "Mark";
  
          $xml-&gt;lastname = "Zuckerberg";
  
          file_put_contents($file, $xml-&gt;asXML());
  </code></pre>
  
  <p>If i try to print this i get following error message: </p>
  
  <pre><code>Call to undefined method stdClass::asXML() in ... on line 1374
  </code></pre>
  
  <p>Any suggestions?</p>