I have some html string:
$string - a string taken from user.
$dom = new DomDocument;
$dom ->preserveWhiteSpace = false;
$dom ->loadHTML('<?xml encoding="UTF-8">'.$string);
How can I find a last text node in DOM tree using PHP? What I want to do is to add some extra chars at the end of to finded string. Next I'll replace old text node with the new string.