I’ve written about DOMDocument in a few other posts (1, 2, 3 to share a few) but I continue to find it useful in different ways.
Remember, DOMDocument is a class in PHP that allows us to manipulate the HTML document before rendering it in the browser.
Represents an entire HTML or XML document; serves as the root of the document tree.
Whenever I think of working with the saveHTML
function, I think of needing to serialize the new information into a file or other output stream before sending it to the browser.
But we don’t have to do that. It can be done in memory.