I had a very inconvenient and specific problem with evaluating simplexml.
The code:
$simplexml = simplexml_load_string($xmlstring);
var_dump($simplexml);
var_dump($simplexml == false);
var_dump ($ simplexml) returns the actual structure of my simplexml, but the comparison returns "true" for this particular simplexml, which I cannot show the structure due to my contract.
I am sure there is a very specific problem because I tried other XML lines and the comparison returns false.
$simplexml = simplexml_load_string('<a><b>test</b></a>');
var_dump($simplexml);
var_dump($simplexml == false);
I solved the problem using the '===' operator, but I am not satisfied that it works. I want to understand why the '==' operator returns true.
I read about two operators and SimpleXMLElement, and in my opinion, it should return false for both operators. What are the possible reasons for comparing the successfully processed SimpleXMLElement and the boolean "false" to return "true"?
source
share