1
I own an object like this:
SimpleXMLElement Object
(
[0] => 1bf7080ac1c04e4e9de924c0a7d9444d
)
But I can not only redeem the value of it. I have tried the following ways:
print_r($obj{0});
print_r($obj{'0'});
print_r($obj->{0});
print_r($obj->{'0'});
print_r($obj[0]);
print_r($obj['0']);
print_r($obj->[0]);
print_r($obj->['0']);
But I was unsuccessful!
Pq does not convert to an array?
– Jorge.M
@Jorgematheus good, I hadn’t thought about it. That somehow already solves my problem. Thanks! ;) But I would still like to know how to rescue as Object.
– alan
Try it like this:
current($obj)
. Current points to the current Index, that is, the first.– Jorge.M
@Jorgematheus Perfect! Add your comment as reply. It may serve for other people tb! ;)
– alan