XPath returns a fully populated list of object based on the expression.
getElementsByTagName accesses the nodes within the tree in real time as
you iterate so you only have one object at a time unless you are
persisting them. Different behavior due to who owns the data and its
lifecycle. XPath
Hi!
Just stumbled upon a strange behaviour when iterating over DOMNodeLists.
Before I open a bug report I'd like to ask if anyone can comment on this
issue, maybe it's the excpected behaviour.
Consider the following small script:
x
x
x
XML;
$dom = new DOMDocument();
$dom->loadXML