Skip to content

Instantly share code, notes, and snippets.

@komlenic
Created November 17, 2011 18:54
Show Gist options
  • Save komlenic/1374083 to your computer and use it in GitHub Desktop.
Save komlenic/1374083 to your computer and use it in GitHub Desktop.
Get innerHTML of a php DOMElement
<?php
// See http://www.php.net/manual/en/class.domelement.php#101243
function get_inner_html( $node ) {
$innerHTML= '';
$children = $node->childNodes;
foreach ($children as $child) {
$innerHTML .= $child->ownerDocument->saveXML( $child );
}
return $innerHTML;
}
?>
@DingLipeng
Copy link

Thank you all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment