Reputation: 14412
Simple question but it's really causing me problems!
I have a var dump as follows; how do I access the array ["slot_id"]
and get it as an actual array? I've tried $object->slot_id
, $object['slot_id']
and $object[0]
with no success. I think I'm just missing something ^_^
object(SimpleXMLElement)#17 (1) {
["slot_id"]=>
array(143) {
[0]=>
string(2) "41"
[1]=>
string(2) "42"
[2]=>
string(2) "43"
....
Upvotes: 1
Views: 174
Reputation: 1743
SimpleXML does not implement the ArrayAccess iterator, unfortunately. There are several code samples in the comments of the php.net documentation page for how to get a SimpleXML object as an array, but I've found it frustrating enough to avoid using it when possible. I have not tried any of these myself, so your mileage may vary.
Upvotes: 2