I am using Xpath in PHP – I know that my query will return either 0 or 1 results.
If 1 result is returned I do not want it as an array – which is what is returned right now. I simply want the value without having to access the [0] element of the result and cast to a string.
Is this possible?
Using ‘evaluate’ instead of ‘query’, you can do things like casting.
DOMXPath::evaluate()Also, if you’re just annoyed with doing stuff a lot of times, just write a function that does it … that is the whole idea behind functions, right?