Formatting data for SimpleXML objects in XML (version 1.0):
<?php$note=<<<XML<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</ body></note>XML;$xml=new SimpleXMLElement($note);echo $xml->asXML();?>
The asXML() function formats data for SimpleXML objects in XML (version 1.0).
asXML(filename);
parameter | describe |
---|---|
filename | Optional. Specifies the name of the file to which data needs to be written. |
Return value: | Returns a string if successful, or FALSE if failed. If the filename parameter is specified, TRUE is returned on success and FALSE on failure. |
---|---|
PHP version: | 5.0.1+ |