PHP 8.5.0 Beta 1 available for testing

Voting

: one plus three?
(Example: nine)

The Note You're Voting On

Ismael Miguel
2 years ago
If you want to save without the XML declaration, and LIBXML_NOXMLDECL doesn't work for you, you can just do this:

<?php
$doc
= new \DOMDocument('1.0', 'UTF-8');
$doc->loadXML($xml, LIBXML_*);

echo
$doc->saveXML($doc->firstElementChild);
?>

This will output the XML without the XML declaration and without using the flag.
You also don't need to do fiddly replacements and pray that it works.

<< Back to user notes page

To Top