I am trying to loop through nodeValues of objects outputed by DOMDocument and get the text output but I am not sure how to go about doing it. My code and output are below.
From the output below I need to get only the NodeValue text output, e.g. "Bar and Hotel".
$dom = new DOMDocument;
@$dom->loadHTML($v);
$xpath = new DomXpath($dom);
$div = $xpath->query('//*[@class="type-cat"]');
foreach ($div as $a) {
var_dump($a );
}
object(DOMElement)#22 (18) {
["tagName"]=> string(2) "h5"
["schemaTypeInfo"]=> NULL
["nodeName"]=> string(2) "h5"
["nodeValue"]=> string(41) " Bar and Hotel"
["nodeType"]=> int(1)
["parentNode"]=> string(22) "(object value omitted)"
["childNodes"]=> string(22) "(object value omitted)"
["firstChild"]=> string(22) "(object value omitted)"
["lastChild"]=> string(22) "(object value omitted)"
["previousSibling"]=> string(22) "(object value omitted)"
["nextSibling"]=> string(22) "(object value omitted)"
["attributes"]=> string(22) "(object value omitted)"
["ownerDocument"]=> string(22) "(object value omitted)"
["namespaceURI"]=> NULL
["prefix"]=> string(0) ""
["localName"]=> string(2) "h5"
["baseURI"]=> NULL
["textContent"]=> string(41) " Bar and Hotel"
}