Forum Moderators: coopster
For curiosities sake, what is the most efficient method for building an XML document?
I think this will depend on the size and complexity of your XML. PHP provides several built in objects for manipulating XML [uk2.php.net] and these will certainly help to maintain valid XML and simplify the creation of complex XML docs. However, objects like SimpleXML maintain the entire structure in memory (as you are doing by concatenating a string) so I can't imagine that working too well for massive XML docs (but again, that might depend on what you are using the XML for)!? If you just a require an XML snippet then I would guess that a bit of string building is about as efficient as it gets?