I’m missing something here…
I have this command:
$xpath->query(‘//input’)->item(0)
The php.net documentation says that DOMNodeList:item should return a DOMNode http://www.php.net/manual/en/domnodelist.item.php, but if I var_dump the result of the above it says it return a DOMElement!
Is php.net wrong or it’s me?
PS: I greatly prefer that it returns a DOMElement though, looks quite more logic!
As Esailija said in his comment
DOMElementextendsDOMNodeso it is indeed returning aDOMNodeor rather an object that shares that interface. That said you cannot depend on it being aDOMElementso if you useDOMElementspecific functionality you need to test that it is aDOMElementand not some other form ofDOMNode.