ConFoo Montreal 2026: Call for Papers

Voting

: min(four, three)?
(Example: nine)

The Note You're Voting On

Daniel Morlock
16 years ago
It would be nice to have a function which converts a document/node/element into a string.

Anyways, I use the following code snippet to get the innerHTML value of a DOMNode:

<?php
function getInnerHTML($Node)
{
$Body = $Node->ownerDocument->documentElement->firstChild->firstChild;
$Document = new DOMDocument();
$Document->appendChild($Document->importNode($Body,true));
return
$Document->saveHTML();
}
?>

<< Back to user notes page

To Top