0 like 0 dislike
28 views
asked in PHP by (5.6k points)

How give DOMElement as string in DOM?

Your answer

Try to answer the question as detailed as possible.
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 (5.6k 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 34 views
0 like 0 dislike
1 answer 25 views
0 like 0 dislike
1 answer 16 views
0 like 0 dislike
1 answer 9 views
0 like 0 dislike
1 answer 25 views
0 like 0 dislike
1 answer 26 views
0 like 0 dislike
1 answer 23 views
0 like 0 dislike
1 answer 38 views
0 like 0 dislike
1 answer 1 view
...