I am using a loop to populate an array called $list. it is working like a charm..
// $content is a DOMNodeList Object
// $value is a DOMElement Object
$list = array();
foreach ($content as $value){
array_push($list, 'title'=>$value->nodeValue);
}
Eventhough my loop is populating my array correctly, I would like to digg into that DOM thing a little more to understand things better (this DOM thing is to new to me...). So what I would like, is to see how the DOMNodeList Object ($content)
and DOMElement Object ($value)
looks like.
So my question is simple: how can I "echo-out" those 'elements'?
Better than "echo-out" DomElement, read the documentation: http://php.net/manual/en/class.domelement.php.
ReplyDeleteIf you want to see XML representation, use http://www.php.net/manual/en/domnode.c14n.php, i.e.
echo $value->c14N(false,true);