I would like to be able to use SimpleXMLElement
Object as an Associative array.
I am trying to convert it using the ArrayObject
class.
What is so special in a SimpleXMLElement
Object that it is not compatible with ArrayObject
class?
Note: I am able to convert it in other ways but I am curious why this method does not work.
$dom = new DOMDocument();
$dom->loadHTML($html);
...
var_dump(new ArrayObject(simplexml_import_dom($dom)));
Gives me: Uncaught exception 'InvalidArgumentException' with message 'Overloaded object of type SimpleXMLElement is not compatible with ArrayObject'