8
<?php
echo getValue('<a>dk</a><b>sh</b>', 'a');
function getValue($string, $tagname) {
$dom = new DomDocument();
$dom->loadXML($string);
$node_list = $dom->getElementsByTagName($tagname)->item(0);
return $node_list->nodeValue;
}
in esecuzione lo script restituiscePHP: contenuti extra alla fine del documento in entità, cercando di estrarre il nodeValue
Warning: DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 1 in /Users/johnkim/get.php on line 7