S
S
Shimpanze2019-01-14 02:29:59
XPath
Shimpanze, 2019-01-14 02:29:59

How are $xpath->query(...) queries different from $xpath->evaluate(...)?

Hello!
Tell me, please, in simple, human language, how do requests differ $xpath->query(...)from $xpath->evaluate(...)?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2019-01-14
@Shimpanze

query - performs a query on a document.
evaluate - performs, I don’t even know how to say in Russian, the calculation of an expression.
the main difference is in the return value:
query returns a DOMNodeList (even empty) or an error.
evaluate returns either the result (if any), or a DOMNodeList, or an error.
example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question