Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2019 15:14
What would you like to do?
/* To output XML as a nicely formatted (line breaks and indentations) on screen */
$doc = new \DOMDocument('1.0');
$doc->preserveWhiteSpace = false;
$doc->formatOutput = true;
$xml_string = $doc->saveXML();
echo $xml_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment