0 like 0 dislike
16 views
asked in PHP by (4.7k points)

How give DOMElement as string in DOM?

Your answer

pre, code

Preview

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

0 like 0 dislike
answered by (4.7k points)
function getStringFromDom($element) {
	$newdoc = new DOMDocument();
	$cloned = $element->cloneNode(TRUE);
	$newdoc->appendChild($newdoc->importNode($cloned,TRUE));
	return $newdoc->saveHTML();
}

Related questions

0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 19 views
0 like 0 dislike
1 answer 8 views
0 like 0 dislike
1 answer 16 views
0 like 0 dislike
1 answer 19 views
0 like 0 dislike
1 answer 18 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 5 views
...