I'm trying to convert an object to an array but I always end up with an empty array.
The object is the following:
DOMElement Object
(
[tagName] => span
[schemaTypeInfo] =>
[nodeName] => span
[nodeValue] =>
[nodeType] => 1
[parentNode] => (object value omitted)
[childNodes] => (object value omitted)
[firstChild] =>
[lastChild] =>
[previousSibling] => (object value omitted)
[nextSibling] => (object value omitted)
[attributes] => (object value omitted)
[ownerDocument] => (object value omitted)
[namespaceURI] =>
[prefix] =>
[localName] => span
[baseURI] =>
[textContent] =>
)
This object is store in $my_object
If I try this:
$test = get_object_vars($my_object);
print_r($test);
I get an empty array.
If I try this:
$test = (array)$my_object;
print_r($test);
I also get an empty array
If I try this:
$array = json_decode(json_encode($my_object), true);
Same result, empty array.
Am I doing something wrong ? Seemed fairly simple but I don't find a way to convert my object into an array.
Any idea?
Thanks
Laurent