PHP SimpleXML new line
I have created a XML file using PHP's simple XML, saved the file. When opening the file in php using fopen and printing the contents. my XML looks like this: (see below) <?xml version="1.0" encoding="UTF-8"?> <home><orderList><delivery_cost>0.00</delivery_cost><delivery_surname>TEST</delivery_surname><delivery_postcode>1234</delivery_postcode><status>1</status></orderList></home> I want the xml file looking all indented and on new lines for each element. Does anybody know how to do this? Thanks You can do this using the formatOutput property of DOMDocument . Save your XML like this instead,