if($xml->getElementsByTagName($elmnt) && $xml->getElementsByTagName($elmnt)->length > 0)
This line is intended to check for errors. All I want is to, instead of breaking the entire page, make a legible error message. It is included in a function designed to stop all related processes on failure and continue displaying the rest of the page if it doesn't work, since the page layout does not depend on whether or not this function succeeds.
Fatal error: Call to a member function getElementsByTagName() on a non-object in file.php on line 100
How do I actually check to make sure that the DOMDocument
in question has the element without it throwing the error above? I've tried using just the first condition or the second condition.
var_dump($xml);
object(DOMDocument)#3 (1) {
["preserveWhitespace"]=>
bool(false)
}