The problem with simplexml_xpath_query returning an array is that how do you signify failure and an empty set. In order for you to have code that uses foreach() it would need to return an empty set on failure in order to avoid warnings.
My preferred solution would be 1) return an array (including empty array for empty result set) 2) return null for error.
This way one can distinguish between error and empty result set if needed and cast to array if it doesn't matter, e.g. for foreach.
To me null is the natural way of signalling an invalid value, see also NULL in SQL.
- Chris
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php