How to properly add newlines to an XML string in PHP?
- by stormist
I have some xml that I manually construct in a function that is something like:
$xml = "<myxml>";
$xml .= "<items>";
$xml .= "<item1>blah</item1>";
$xml .= "</items>";
$xml .= "</myxml>";
When I output the string though I'd like the newlines to be present. How can I add this to the string without affecting a web service accepting the xml? Do newlines in XML even matter?